You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You may include [action links](http://engineeringblog.yelp.com/2015/07/yelp-api-now-returns-action-links.html) in your results by passing additional parameters with your request.
$client->setDefaultLocation('Chicago, IL') // default location for all searches if location not provided
45
+
->setDefaultTerm('Sushi') // default keyword for all searches if term not provided
46
+
->setSearchLimit(20); // number of records to return
47
+
```
48
+
49
+
## Exceptions
50
+
51
+
If the API request results in an Http error, the client will throw a `\Stevenmaguire\Yelp\Exception\HttpException` that includes the response body, as a string, from the Yelp API.
Yelp API version 3 (Fusion) [requires an OAuth2 access token to authenticate each request](https://www.yelp.com/developers/documentation/v3/authentication). The [oauth2-yelp](https://github.com/stevenmaguire/oauth2-yelp) is available to help obtain an access token.
6
+
7
+
```php
8
+
// Get access token via oauth2-yelp library
9
+
$provider = new \Stevenmaguire\OAuth2\Client\Provider\Yelp([
See also [https://www.yelp.com/developers/documentation/v3/business_search_phone](https://www.yelp.com/developers/documentation/v3/business_search_phone)
If the API request results in an Http error, the client will throw a `Stevenmaguire\Yelp\Exception\HttpException` that includes the response body, as a string, from the Yelp API.
This package currently supports `v2` and `v3` (Fusion) of the Yelp API. Each version of the Yelp API maps to a different client, as the APIs are very different. Each client has separate documentation; links provided below.
If the API request results in an Http error, the client will throw a `Stevenmaguire\Yelp\Exception\HttpException` that includes the response body, as a string, from the Yelp API.
$responseBody = $e->getResponseBody(); // string from Http request
70
+
$responseBodyObject = json_decode($responseBody);
50
71
```
51
72
52
-
You may include [action links](http://engineeringblog.yelp.com/2015/07/yelp-api-now-returns-action-links.html) in your results by passing additional parameters with your request.
73
+
### Advanced usage
74
+
75
+
Both the [v3 client](API-GUIDE-v3.md) and the [v2 client](API-GUIDE-v2.md) expose some public methods that allow overiding default behavior by providing alternative HTTP clients and requests.
If 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.
98
+
// See the contents
99
+
echo $response->getBody();
100
+
```
101
+
102
+
## Upgrading with Yelp API v2 support from `yelp-php 1.x` to `yelp-php 2.x`
71
103
72
104
```php
73
-
$responseBody = $e->getResponseBody(); // string from Http request
0 commit comments