jooservices / xclient
Wrapper for Guzzle HTTP Client
0.1.4.2
2023-03-01 09:25 UTC
Requires
- php: ^8.1
- fakerphp/faker: ^1.21
- guzzlehttp/guzzle: ^7.
- psr/log: ^3.0
- symfony/dom-crawler: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: *
- mockery/mockery: ^1.4
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5.10
- squizlabs/php_codesniffer: ^3.7
This package is not auto-updated.
Last update: 2024-11-06 17:53:24 UTC
README
Wrapped for GuzzleHttp Client
Factory
used for making Client with wrapped middlewares
- Cache
- Mocking for Tests
XCrawlerClient
is Factory
wrapper with advanced thing
- Parse
response
(ResponseInterface
)
Here are few implementation of ResponseInterface
DomResponse
automatically concert to DomCrawlerJsonResponse
automatically convert json to arrayFlickrResponse
specific for Flickr jsonNow
specific for NowService
How to work with cache
$local = new FlysystemStorage(new Local(__DIR__ . '/cache'));
$url = $this->faker->url;
$cache = new CacheMiddleware(
new PrivateCacheStrategy(
$local
)
);
$factory = new Factory($this->logger, 200);
How to work with mocks
Provide 4xx - 5xx for Error case
$factory = new Factory($this->logger, 200);
TODO
- Support OAuth 1/2
- Support Flickr