https://github.com/code16/machina-client
Client package for code16/machina
https://github.com/code16/machina-client
Last synced: 7 months ago
JSON representation
Client package for code16/machina
- Host: GitHub
- URL: https://github.com/code16/machina-client
- Owner: code16
- Created: 2018-03-09T06:53:27.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T13:46:13.000Z (11 months ago)
- Last Synced: 2025-05-17T07:11:12.506Z (8 months ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Machina Client
"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
```php
$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