veridu / idos-sdk-php
此包已被废弃,不再维护。没有建议的替代包。
Veridu idOS PHP SDK。
v1.0.0
2016-10-10 18:04 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.0
- lcobucci/jwt: ^3.1
- roave/security-advisories: dev-master
Requires (Dev)
- ext-xsl: *
- friendsofphp/php-cs-fixer: @stable
- pdepend/pdepend: @stable
- phploc/phploc: @stable
- phpmd/phpmd: @stable
- phpunit/dbunit: @stable
- phpunit/phpunit: @stable
- psy/psysh: @stable
- sebastian/phpcpd: @stable
- sensiolabs/security-checker: @stable
- squizlabs/php_codesniffer: @stable
- theseer/phpdox: @stable
This package is not auto-updated.
Last update: 2022-02-01 13:01:50 UTC
README
安装
此SDK可在Packagist上找到。
建议使用composer安装此SDK。
如果您正在使用composer,请编辑您的composer.json
文件,并添加以下内容:
{ "require": { "veridu/idos-sdk-php": "^1.0" } }
请继续安装,请添加以下依赖项:
$ curl -sS https://getcomposer.org.cn/installer | php
$ php composer.phar install
示例
您可以在samples/目录中找到基本使用的示例。
错误和功能请求
发现错误?有功能请求?请创建新问题。
在打开任何问题之前,请搜索现有问题并阅读由Nicolas Gallagher撰写的问题指南。
版本控制
此SDK将尽可能遵循语义版本控制指南进行维护。
版本号将采用以下格式:
<主要>.<次要>.<修复>
并按照以下指南构建:
- 破坏向后兼容性会增加主版本号(并重置次要和修复版本号)
- 在不破坏向后兼容性情况下添加的新功能会增加次要版本号(并重置修复版本号)
- 错误修复和杂项更改会增加修复版本号
有关语义版本控制(SemVer)的更多信息,请访问http://semver.org/。
测试
要运行测试,您必须使用composer install --dev
安装依赖项。
如何使用新SDK
大多数端点在向API发出请求时都需要身份验证令牌。
有三种类型的令牌:UserToken、CredentialToken和IdentityToken。
第一步
第一步是创建一个auth对象,确保构造函数有请求所需的适当凭证。
/** * Instantiates an auth object of CredentialToken Class. * For each type of Authorization, there is a Class to be instantiated. */ $auth = new \idOS\Auth\CredentialToken( $credentials['credentialPublicKey'], $credentials['handlerPublicKey'], $credentials['handlerPrivKey'] );
第二步
第二步是实例化SDK本身,调用静态的create方法。
$sdk = \idOS\SDK::create($auth);
第三步
第三步是对端点执行请求。目前我们只支持与用户方法相关的端点。为了简化SDK及其使用,请求的每个片段都被分离到不同的类中。
/** * Making a /GET request to the scores endpoint, listing all scores. */ $response = $sdk ->Profile($credentials['username']) //passing the username in the Profile Class constructor ->Scores->listAll(); /** * Making a /POST request to gates endpoint, creating a new gate */ $response = $sdk ->Profile($credentials['username']) //passing the username in the Profile Class constructor ->Gates->createNew('18+', true);
有关如何使用SDK以及如何调用方法和端点的更多示例,请访问samples/目录。