code16 / machina-client
code16/machina 的客户端包
v3.4
2024-03-07 14:00 UTC
Requires
- php: ^8.1|^8.2|^8.3
- guzzlehttp/guzzle: ^7.5.0
- illuminate/support: ^10.0|^11.0
Requires (Dev)
- code16/machina: ^1.0
- orchestra/testbench: 8.*|^9.0
- phpunit/phpunit: 9.6.*
README
"code16/machina-client" 旨在用于实现与受 Code16/Machina JWT Token 认证保护 JSON API 通信的客户端。它是围绕 GuzzleHttp
的简单包装,并为您处理查询/刷新 JWT 令牌。
安装
composer require code16/machina-client
使用方法
$client = new \Code16\MachinaClient\MachinaClient; $client->setBaseUrl("https://example.com/api"); $client->setCredentials([ "client" => "some-client-key", "secret" => "some-secret-key", ]); try { $client->get("/foo"); // ['foo => bar']; } catch(\Code16\MachinaClient\Exceptions\InvalidCredentialsException $e) { // Incorrect credentials }
许可证
(c) 2018 code16.fr
MIT