wwpass / apiclient
WWPass API 的 PHP 实现
4.0
2020-01-15 22:37 UTC
Requires
- php: >=7.0
This package is not auto-updated.
Last update: 2024-09-19 21:47:07 UTC
README
Composer 兼容的 WWPass API 客户端库。
对于单文件非 Composer 库,请参考 https://github.com/wwpass/wwpass-php-sdk。
安装
$ composer require wwpass/apiclient
用法
该库在 WWPass 命名空间中定义了两个类:WWPass\Connection 和 WWPass\Exception。
require_once 'vendor/autoload.php'; try { $wwc = new WWPass\Connection(array( 'key_file' => WWPASS_SPFE_KEY_FILE, 'cert_file' => WWPASS_SPFE_CERT_FILE, 'ca_file' => WWPASS_SPFE_CA_FILE )); $response = $wwc->getTicket(array( 'ttl' => 300, 'pin' => true )); $ttl = $response['ttl']; $ticket = $response['ticket']; } catch (WWPass\Exception $e) { echo 'Caught WWPass exception: ' . $e->getMessage(); } catch (Exception $e) { echo 'Caught exception: ' . $e->getMessage(); }
许可证
WWPass PHP 库采用 Apache 2.0 许可证授权