duosecurity / duo_api_php
该软件包最新版本(1.1.0)没有提供许可证信息。
PHP 实现的 Duo API。
1.1.0
2023-06-09 17:55 UTC
Requires
- php: >=8.0
- ext-curl: *
Requires (Dev)
- php-coveralls/php-coveralls: dev-master
- phpunit/phpunit: ~9
- squizlabs/php_codesniffer: 2.*
This package is not auto-updated.
Last update: 2024-09-16 20:47:37 UTC
README
认证 - https://www.duosecurity.com/docs/authapi
管理 - https://www.duosecurity.com/docs/adminapi
账户 - https://www.duosecurity.com/docs/accountsapi
测试的 PHP 版本
- 8.0
- 8.1
- 8.2
TLS 1.2 和 1.3 支持
Duo_api_php 使用 PHP 的 cURL 扩展和 OpenSSL 进行 TLS 操作。TLS 支持将取决于多个库的版本
TLS 1.2 支持 PHP 5.5 或更高版本,curl 7.34.0 或更高版本,以及 OpenSSL 1.0.1 或更高版本。
TLS 1.3 支持 PHP 7.3 或更高版本,curl 7.61.0 或更高版本,以及 OpenSSL 1.1.1 或更高版本。
安装
开发
$ git clone https://github.com/duosecurity/duo_api_php.git
$ cd duo_api_php
$ composer install
系统
$ composer global require duosecurity/duo_api_php:dev-master
或将以下内容添加到您的项目中
{
"require": {
"duosecurity/duo_api_php": "dev-master"
}
}
使用
$ php -a -d auto_prepend_file=vendor/autoload.php
Interactive mode enabled
php > $D = new DuoAPI\Auth($ikey, $skey, $host);
php > var_dump($D->preauth($username));
array(2) {
'response' =>
array(2) {
'response' =>
array(3) {
'enroll_portal_url' =>
string(23) "https://api-example.com"
'result' =>
string(6) "enroll"
'status_msg' =>
string(42) "Enroll an authentication device to proceed"
}
'stat' =>
string(2) "OK"
}
'success' =>
bool(true)
}
测试
$ ./vendor/bin/phpunit -c phpunit.xml
注意,tests/SSL/SSLTest.php
中的测试需要 stunnel3
。
代码检查
$ ./vendor/bin/phpcs --standard=PSR2 -n src/* tests/*