code16 / machina-client
Client package for code16/machina
Installs: 8 341
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
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" is aimed to be used for implementing client to communicate with JSON APIs protected with the Code16/Machina JWT Token authentication guard. It's a simple wrapper around GuzzleHttp
and takes cares of querying/refreshing JWT token for you.
Installation
composer require code16/machina-client
Usage
$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 }
License
(c) 2018 code16.fr
MIT