PHP code example of petfinder-com / petfinder-php

1. Go to this page and download the library: Download petfinder-com/petfinder-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

petfinder-com / petfinder-php example snippets


$client = new \Petfinder\Client('my-api-key', 'my-api-secret');

$client->animal->search(['type' => 'Dog']);

$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
});

$builder = new \Petfinder\Http\Builder($myHttpClient);
$client = new \Petfinder\Client('my-api-key', 'my-api-secret', $builder);