A PHP client for authenticating with Yelp using OAuth 1 and consuming the search API.
Via Composer
$ composer require stevenmaguire/yelp-phpor update your composer.json file to include:
"require": {
"stevenmaguire/yelp-php": "~1.2"
}Run composer update
$client = new Stevenmaguire\Yelp\Client(array(
'consumer_key' => 'YOUR COSUMER KEY',
'consumer_secret' => 'YOUR CONSUMER SECRET',
'token' => 'YOUR TOKEN',
'token_secret' => 'YOUR TOKEN SECRET',
'api_host' => 'api.yelp.com' // Optional, default 'api.yelp.com'
));$results = $client->search(array('term' => 'Sushi', 'location' => 'Chicago, IL'));$results = $client->searchByPhone(array('phone' => '867-5309'));$results = $client->getBusiness('union-chicago-3');$client->setDefaultLocation('Chicago, IL') // default location for all searches if location not provided
->setDefaultTerm('Sushi') // default keyword for all searches if term not provided
->setSearchLimit(20); // number of records to returnIf the API request results in an Http error, the client will throw a Stevenmaguire\Yelp\Exception that includes the response body, as a string, from the Yelp API.
$responseBody = $e->getResponseBody(); // string from Http request
$responseBodyObject = json_decode($responseBody);$ phpunitPlease see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.