Compare commits

...

8 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
Will Power 83918a7658 Restore company name in demo (#153) 2025-12-01 13:33:04 +00:00
Rob Janssen 9b2d795acc Merge pull request #149 from dereuromark/patch-1
Fix up readme
2025-04-11 00:41:11 +02:00
Mark Scherer 24f6d2fd10 Fix up readme 2025-04-11 00:25:59 +02:00
YellowMaker 6d70f9ca8e add support for endroid/qr-code (with logo) version 6 (#143) 2024-10-24 16:14:25 +01:00
8 changed files with 47 additions and 21 deletions
+8 -3
View File
@@ -10,11 +10,16 @@ jobs:
strategy:
matrix:
php-version: ['8.2', '8.3']
bacon-version: ['^2', '^3']
php-version: [8.2, 8.3, 8.4, 8.5]
bacon-version: ["^2", "^3"]
exclude:
- php-version: 8.4
bacon-version: "^2"
- php-version: 8.5
bacon-version: "^2"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2
with:
+16 -3
View File
@@ -10,11 +10,24 @@ jobs:
strategy:
matrix:
php-version: ['8.2', '8.3']
endroid-version: ["^3","^4","^5","^6"]
php-version: [8.2, 8.3, 8.4, 8.5]
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:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2
with:
+2 -2
View File
@@ -10,10 +10,10 @@ jobs:
strategy:
matrix:
php-version: ['8.2', '8.3']
php-version: [8.2, 8.3, 8.4, 8.5]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: shivammathur/setup-php@v2
with:
+1 -1
View File
@@ -33,7 +33,7 @@ If you need more in-depth information about the configuration available then you
## Integrations
- [CakePHP 3](https://github.com/andrej-griniuk/cakephp-two-factor-auth)
- [CakePHP plugin](https://github.com/andrej-griniuk/cakephp-two-factor-auth)
- [CI4-Auth: a user, group, role and permission management library for Codeigniter 4](https://github.com/glewe/ci4-auth)
## License
+4 -2
View File
@@ -11,8 +11,10 @@
include_once str_replace(array('RobThree\\Auth', '\\'), array(__DIR__.'/../lib', '/'), $className) . '.php';
});
// substitute your company or app name here
$tfa = new RobThree\Auth\TwoFactorAuth(new RobThree\Auth\Providers\Qr\QRServerProvider());
$tfa = new RobThree\Auth\TwoFactorAuth(
new RobThree\Auth\Providers\Qr\QRServerProvider(),
"Acme Corp" // substitute your company or app name here
);
?>
<li>First create a secret and associate it with a user</li>
<?php
+7 -4
View File
@@ -21,17 +21,20 @@ Example code:
```php
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\EndroidQrCodeProvider; // if using Endroid
// using the default Qr Code provider from the library
$tfa = new TwoFactorAuth(new QRServerProvider(), "Your app name");
// using Bacon
$tfa = new TwoFactorAuth(new BaconQrCodeProvider());
$tfa = new TwoFactorAuth(new BaconQrCodeProvider(), "Your app name");
// using Endroid
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider());
$tfa = new TwoFactorAuth(new EndroidQrCodeProvider(), "Your app name");
// 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
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator);
$tfa = new TwoFactorAuth(qrcodeprovider: $qrGenerator, issuer: "Your app name");
```
## 3. Shared secrets
@@ -26,7 +26,6 @@ abstract class BaseHTTPQRCodeProvider implements IQRCodeProvider
throw new QRException(curl_error($curlhandle));
}
curl_close($curlhandle);
return $data;
}
}
@@ -33,11 +33,15 @@ class EndroidQrCodeWithLogoProvider extends EndroidQrCodeProvider
$logo = null;
if ($this->logoPath) {
$logo = Logo::create($this->logoPath);
if ($this->logoSize) {
$logo->setResizeToWidth($this->logoSize[0]);
if (isset($this->logoSize[1])) {
$logo->setResizeToHeight($this->logoSize[1]);
if ($this->endroid6) {
$logo = new Logo($this->logoPath, ...$this->logoSize);
} else {
$logo = Logo::create($this->logoPath);
if ($this->logoSize) {
$logo->setResizeToWidth($this->logoSize[0]);
if (isset($this->logoSize[1])) {
$logo->setResizeToHeight($this->logoSize[1]);
}
}
}
}