Skip to content

Commit dc87861

Browse files
committed
Add configuration options for models, notifications, QR code backend, and trusted device settings in README
1 parent 667c1fb commit dc87861

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,96 @@ Event::listen(Logout::class, function ($event) {
134134
### 5️⃣ Customize settings from the config file
135135

136136
```php
137+
<?php
138+
137139
return [
140+
141+
/*
142+
|--------------------------------------------------------------------------
143+
| Models Configuration
144+
|--------------------------------------------------------------------------
145+
|
146+
| Define the models used by the package here. These models will be used
147+
| for users and trusted device storage.
148+
|
149+
*/
150+
138151
'user_model' => \App\Models\User::class,
152+
139153
'trust_device_model' => \MixCode\FilamentMulti2fa\Models\TrustDevice::class,
154+
155+
/*
156+
|--------------------------------------------------------------------------
157+
| Notifications
158+
|--------------------------------------------------------------------------
159+
|
160+
| Specify the notification class responsible for sending the OTP code
161+
| to the user.
162+
|
163+
*/
164+
140165
'otp_notification_class' => \MixCode\FilamentMulti2fa\Notifications\TwoFactorCodeNotification::class,
166+
167+
/*
168+
|--------------------------------------------------------------------------
169+
| QR Code Rendering Backend
170+
|--------------------------------------------------------------------------
171+
|
172+
| Choose the QR code rendering service to generate the QR Code for TOTP.
173+
|
174+
| Supported Services:
175+
|
176+
| 1. BaconQrCode (default):
177+
| - Renders PNG (inline or file)
178+
| - Requires the Imagick PHP extension (depending on backend)
179+
| - Can render SVG with custom setup, but PNG is common default
180+
|
181+
| 2. chillerlan/php-qrcode:
182+
| - Outputs base64-encoded PNG by default
183+
| - Supports SVG rendering via OUTPUT_MARKUP_SVG
184+
| - Does NOT require Imagick or GD by default for PNG base64
185+
| - Other formats (PNG file, SVG file) may require GD/Imagick if saved to disk
186+
|
187+
*/
188+
189+
// Default to BaconQrCode
190+
'qr_code_backend_service' => \PragmaRX\Google2FAQRCode\QRCode\Bacon::class,
191+
192+
// To use chillerlan/php-qrcode (SVG by default), uncomment below:
193+
// 'qr_code_backend_service' => \PragmaRX\Google2FAQRCode\QRCode\Chillerlan::class,
194+
195+
/*
196+
|--------------------------------------------------------------------------
197+
| OTP View Template
198+
|--------------------------------------------------------------------------
199+
|
200+
| Specify the Blade view that will be used for rendering the OTP email.
201+
|
202+
*/
203+
141204
'otp_view' => 'filament-multi-2fa::emails.2fa.otp',
205+
206+
/*
207+
|--------------------------------------------------------------------------
208+
| Trusted Device Settings
209+
|--------------------------------------------------------------------------
210+
|
211+
| Configure trusted device cookie settings, including cookie name,
212+
| lifespan in minutes, and cache settings to minimize DB hits.
213+
|
214+
*/
215+
142216
'trusted_device_cookie_name' => 'trusted_device',
217+
218+
// Duration (in minutes) before a trusted device expires in the database
143219
'trusted_device_db_expiration' => 60 * 24 * 30, // 30 days
220+
221+
// Duration (in minutes) before a trusted device cookie expires
144222
'trusted_device_cookie_lifespan' => 60 * 24 * 30, // 30 days
223+
224+
// Duration (in minutes) to cache trusted device checks to reduce DB queries
145225
'trust_device_check_cache_lifespan' => 60 * 24 * 30, // 30 days
226+
146227
];
147228
```
148229

0 commit comments

Comments
 (0)