boundstate / petfinder-php
Petfinder API client
v1.1.0
2022-02-28 20:03 UTC
Requires
- ext-json: *
- mtdowling/jmespath.php: ^2.2
- php-http/async-client-implementation: ^1.0
- php-http/client-common: ^1.6 || ^2.0
- php-http/discovery: ^1.0
- php-http/httplug: ^1.1 || ^2.0
- php-http/message-factory: ^1.0
- psr/http-message: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- guzzlehttp/psr7: ^1.5
- php-coveralls/php-coveralls: ^2.1
- php-http/guzzle6-adapter: ^2.0
- php-http/mock-client: ^1.3
- phpstan/phpstan: ^0.11.4
- phpstan/phpstan-phpunit: ^0.11.0
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-10-29 01:57:06 UTC
README
A simple wrapper for the Petfinder API, written in PHP.
Uses Petfinder API v2.
Features
- Uses HTTPlug
- Supports Async requests
- Well tested
Requirements
- PHP >= 7.1
- A HTTPlug Async client
- A PSR-7 implementation
Install
In addition to the Petfinder package, you'll need an HTTPlug
client that support async requests. We recommend using php-http/guzzle6-adapter
,
but you are free to use whatever one works for you.
composer require petfinder-com/petfinder-php php-http/guzzle6-adapter
Usage
Basic usage
$client = new \Petfinder\Client('my-api-key', 'my-api-secret'); $client->animal->search(['type' => 'Dog']);
Using async requests
$client = new \Petfinder\Client('my-api-key', 'my-api-secret'); $client->organization->searchAsync()->then(function (\Petfinder\Result $result) { // Do something with $result })->catch(function (\Petfinder\Exception\ProblemDetailsException $exception) { // Do something with $exception });
Using a custom Httplug client
$builder = new \Petfinder\Http\Builder($myHttpClient); $client = new \Petfinder\Client('my-api-key', 'my-api-secret', $builder);