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
5 changed files with 33 additions and 13 deletions
+8 -3
View File
@@ -10,11 +10,16 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: ['8.2', '8.3'] php-version: [8.2, 8.3, 8.4, 8.5]
bacon-version: ['^2', '^3'] bacon-version: ["^2", "^3"]
exclude:
- php-version: 8.4
bacon-version: "^2"
- php-version: 8.5
bacon-version: "^2"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2 - uses: shivammathur/setup-php@v2
with: with:
+15 -2
View File
@@ -10,11 +10,24 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: ['8.2', '8.3'] php-version: [8.2, 8.3, 8.4, 8.5]
endroid-version: ["^3", "^4", "^5", "^6"] endroid-version: ["^3", "^4", "^5", "^6"]
exclude:
- php-version: 8.4
endroid-version: "^3"
- php-version: 8.4
endroid-version: "^4"
- php-version: 8.4
endroid-version: "^5"
- php-version: 8.5
endroid-version: "^3"
- php-version: 8.5
endroid-version: "^4"
- php-version: 8.5
endroid-version: "^5"
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2 - uses: shivammathur/setup-php@v2
with: with:
+2 -2
View File
@@ -10,10 +10,10 @@ jobs:
strategy: strategy:
matrix: matrix:
php-version: ['8.2', '8.3'] php-version: [8.2, 8.3, 8.4, 8.5]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2 - uses: shivammathur/setup-php@v2
with: with:
+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;
} }
} }