smart-contact / trustpilot-api-service
Trustpilot 的 PHP API 服务
v1.2.1
2024-01-10 16:39 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.5
- nesbot/carbon: ^2.66
Requires (Dev)
- phpunit/phpunit: ^10.0
- vlucas/phpdotenv: ^5.4
README
Trustpilot API 的 PHP 服务类。
安装
您可以通过 composer 安装此包
composer require smart-contact/trustpilot-api-service
使用方法
要使用此类,您必须传递以下信息:业务单元 ID、API 密钥、API 密钥、您的用户名和密码。
所有可用方法都尽量遵循 API 文档中的相同名称。所有 'GET' 请求都接受查询参数作为查询参数,并使用与文档中相同的键。所有 'POST' 请求都接受 2 个参数,数据(data)和选项(可选),与查询参数相同,所有键都与文档中相同。
use SmartContact/TrustpilotApiService/TrustpilotApiService; $trustpilotService = new TrustpilotApiService(); $trustpilotService->init([ 'business_unit_id' => '123456789', 'api_key' => 'abcdefghijklmnopqrstuvwxyz', 'api_secret' => '123456789abcdefghi', 'username' => 'user@trustpilot.com', 'password' => 'P4ssw0rd' ]); //authenticate to get a valid token $trustpilotService->authenticate(); // if you use the same instance, once you have authenticated the service will automatically refresh the token when it is expired //get invitation templates $data = $trustpilotService->getInvitationTemplates(); var_dump($data['templates']);
测试
composer test
变更日志
请参阅CHANGELOG以获取有关最近更改的更多信息。
贡献
请参阅CONTRIBUTING以获取详细信息。
致谢
许可
MIT 许可(MIT)。有关更多信息,请参阅许可文件。
PHP 包模板
此包是使用 PHP 包模板 和 Beyond Code 生成的。