Skip to content

Commit 85408c4

Browse files
authored
doc: getting started: improve examples (#154)
add example for default lib qr provider and add issuer too see #152
1 parent 3516aae commit 85408c4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/getting-started.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,20 @@ Example code:
2121

2222
```php
2323
use RobThree\Auth\TwoFactorAuth;
24+
use RobThree\Auth\Providers\Qr\QRServerProvider; // if using library's provider
2425
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider; // if using Bacon
2526
use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider; // if using Endroid
2627

28+
// using the default Qr Code provider from the library
29+
$tfa = new TwoFactorAuth(new QRServerProvider(), "Your app name");
2730
// using Bacon
28-
$tfa = new TwoFactorAuth(new BaconQrCodeProvider());
31+
$tfa = new TwoFactorAuth(new BaconQrCodeProvider(), "Your app name");
2932
// using Endroid
30-
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider());
33+
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider(), "Your app name");
3134
// using a custom object implementing IQRCodeProvider interface
32-
$tfa = new TwoFactorAuth(new MyQrCodeProvider());
35+
$tfa = new TwoFactorAuth(new MyQrCodeProvider(), "Your app name");
3336
// using named argument and a variable
34-
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator);
37+
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator, issuer: "Your app name");
3538
```
3639

3740
## 3. Shared secrets

0 commit comments

Comments
 (0)