floweye / client
Floweye PHP API client
Installs: 4 826
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
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
UserService
UserGroupService