Compare commits

..

4 Commits

Author SHA1 Message Date
Nicolas CARPi 85408c4e77 doc: getting started: improve examples (#154)
add example for default lib qr provider and add issuer too

see #152
2026-01-05 13:17:41 +00:00
Givan 3516aae5a3 Removed curl_close that has no effect since PHP 8.0 to avoid deprecation warning on PHP 8.5 (#155)
Since 8.0 a CurlHandle object is returned, and curl_close() has no effect, so this change won't impact earlier versions.
2026-01-05 13:16:44 +00:00
William Hall a2fa4c11a9 🔧 exclude problematic versions from automated tests 2026-01-05 13:16:07 +00:00
William Hall 57970d3d5f 🔧 update workflows 2026-01-05 13:16:07 +00:00
2 changed files with 7 additions and 5 deletions
+7 -4
View File
@@ -21,17 +21,20 @@ Example code:
```php ```php
use RobThree\Auth\TwoFactorAuth; use RobThree\Auth\TwoFactorAuth;
use RobThree\Auth\Providers\Qr\QRServerProvider; // if using library's provider
use RobThree\Auth\Providers\Qr\BaconQrCodeProvider; // if using Bacon use RobThree\Auth\Providers\Qr\BaconQrCodeProvider; // if using Bacon
use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider; // if using Endroid use RobThree\Auth\Providers\Qr\EndroidQrCodeProvider; // if using Endroid
// using the default Qr Code provider from the library
$tfa = new TwoFactorAuth(new QRServerProvider(), "Your app name");
// using Bacon // using Bacon
$tfa = new TwoFactorAuth(new BaconQrCodeProvider()); $tfa = new TwoFactorAuth(new BaconQrCodeProvider(), "Your app name");
// using Endroid // using Endroid
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider()); $tfa = new TwoFactorAuth(new EndroidQrCodeProvider(), "Your app name");
// using a custom object implementing IQRCodeProvider interface // using a custom object implementing IQRCodeProvider interface
$tfa = new TwoFactorAuth(new MyQrCodeProvider()); $tfa = new TwoFactorAuth(new MyQrCodeProvider(), "Your app name");
// using named argument and a variable // using named argument and a variable
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator); $tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator, issuer: "Your app name");
``` ```
## 3. Shared secrets ## 3. Shared secrets
@@ -26,7 +26,6 @@ abstract class BaseHTTPQRCodeProvider implements IQRCodeProvider
throw new QRException(curl_error($curlhandle)); throw new QRException(curl_error($curlhandle));
} }
curl_close($curlhandle);
return $data; return $data;
} }
} }