floweye / client
Floweye PHP API client
Installs: 5 183
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- ext-json: *
- guzzlehttp/guzzle: ^7.1.0
- nette/utils: ^2.2 || ^3.0 || ^4.0
Requires (Dev)
- nette/di: ^2.4.15 || ^3.0.0
- ninjify/coding-standard: ^0.12.0
- phpstan/phpstan: ^0.12.0
- phpstan/phpstan-deprecation-rules: ^0.12.0
- phpstan/phpstan-nette: ^0.12.0
- phpstan/phpstan-strict-rules: ^0.12.0
- phpunit/phpunit: ^8.5.5
README
PHP API client for Floweye - REST API - Docs
Versions
State | Version | Branch | Nette | PHP |
---|---|---|---|---|
dev | ^1.0.0 |
master |
2.4 , 3.0 |
>=8.1 |
stable | ^0.4.1 |
master |
2.4 , 3.0 |
>=7.2 |
Instalation
Install package using Composer.
composer require floweye/client
How to use
High level
Simply inject desired services which allow you to work directly with processed data.
$userService = $context->getService(Floweye\Client\Service\UserService::class); $user = $userService->getById(1, []);
PSR-7 level
In case you need to access PSR-7 response. You can work with our client layer.
$userClient = $context->getService(Floweye\Client\Client\UserClient::class); /** @var Psr\Http\Message\ResponseInterface $response */ $response = $userClient->getById(1, []);
Low level
This example showcases the manual service instantiation.
$guzzleFactory = $context->getService(Floweye\Client\Http\Guzzle\GuzzleFactory::class); $httpClient = $guzzleFactory->create([ 'base_uri' => 'https://floweye.tld/api/v1/', 'http_errors' => false, 'headers' => [ 'X-Api-Token' => 'floweye-api-key', ] ]); // You can now use $httpClient with our Clients, Services or on its own $userClient = new Floweye\Client\Client\UserClient($httpClient); $userService = new Floweye\Client\Service\UserService($userClient);
Nette bridge
extensions: # For Nette 3.0+ floweye.api: Floweye\Client\DI\FloweyeExtension # For Nette 2.4 floweye.api: Floweye\Client\DI\FloweyeExtension24 floweye.api: debug: %debugMode% http: base_uri: https://floweye.tld/api/v1/ headers: X-Api-Token: floweye_api_key
Configure default http client Guzzle HTTP client under http
option.
API endpoints overview
ApplicationService
Method | API |
---|---|
export($include) | GET /application/export |
import($data) | POST /application/import |
listGlobals($path) | GET /application/globals |
editGlobals($globals) | PUT /application/globals |
listSnippets($limit, $offset, $include) | GET /application/snippets |
createSnippet($entity) | POST /application/snippets |
editSnippet($id, $entity) | PUT /application/snippets/{id} |
deleteSnippet($id) | DELETE /application/snippets/{id} |
UserService
Method | API |
---|---|
list($filter) | GET /users |
create($entity) | POST /users |
getById($id, $include) | GET /users/{id} |
edit($id, $entity) | PUT /users/{id} |
oneTimeLogin($id) | PUT /users/{id}/one-time-login |
passwordReset($id) | PUT /users/{id}/password-reset |
newUserToken($id) | PUT /users/{id}/new-user/token |
newUserMail($id) | PUT /users/{id}/new-user/mail |
UserGroupService
Method | API |
---|---|
listUserGroups($include) | GET /user-groups |
createOne($entity) | POST /user-groups |
findOne($gid, $include) | GET /user-groups/{gid} |
editOne($gid, $entity) | PUT /user-groups/{gid} |
deleteOne($gid) | DELETE /user-groups/{gid} |
appendUsers($gid, $userIds, $includeSystemUsers, $includeBlockedUsers) | PATCH /user-groups/{gid}/append-users |
detachUsers($gid, $userIds) | PATCH /user-groups/{gid}/detach-users |