Download the PHP package thevaliantway/yelp-php without Composer
On this page you can find all versions of the php package thevaliantway/yelp-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download thevaliantway/yelp-php
More information about thevaliantway/yelp-php
Files in thevaliantway/yelp-php
Package yelp-php
Short Description PHP Client wrapper for Yelp's Fusion API
License MIT
Informations about the package yelp-php
Yelp Fusion API Wrapper
A PHP Client wrapper for Yelp's Fusion API
Yelp's Fusion API allows you to get the best local business information and user reviews of over million businesses in 32 countries.
This PHP client wrapper for Yelp's Fusion API makes it dead simple. Query the API using key/value pairs to pass along search parameters, and recieve a stdClass object to work with.
Installation
Require this package with composer using the following command:
Authentication
Yelp's Fusion API uses OAuth2 for Authentication. Use the bearerRequest()
method to retrieve an access token.
On success, the method will return an object containing the following:
Name | Type | Description |
---|---|---|
access_token | string | The access token which you'll use to access Yelp Fusion API endpoints. |
token_type | int | The access token type. Always returns Bearer. |
expires_in | int | Represents the number of seconds after which this access token will expire. Right now it's always 15552000, which is 180 days. |
Access tokens are valid for 180 days, so a caching strategy for issued tokens suggested.
Once a valid token has been issued, you'll be able to work with the methods below.
Business Search
Returns up to 1000 businesses based on the provided search criteria. Each API call is limited to a maximum of 50 results, so use the offset
parameter to access results beyond the initial 50 returned.
The following example will query the API for the 5 closest restaurants within 500 meters of zip code 10001, sorted by distance.
You can use the id returned for a business with the getBusiness()
method to retrieve detailed information.
Additional search parameters, along with detail on the API's response, may be found at https://www.yelp.com/developers/documentation/v3/business_search
Phone Search
Returns a list of businesses based on the provided phone number. It is possible for more than one businesses having the same phone number (for example, chain stores with the same +1 800 phone number).
The following example will query the API for businesses with "+12127527470" as the listed phone number.
Note: The phone number used for searching must start with "+" and include the country code.
Detail on the API's response may be found at https://www.yelp.com/developers/documentation/v3/business_search_phone
Transaction Search
Returns a list of businesses which support certain transactions.
The following example will query the API for businesses that deliver to the specified coordinates:
Detail on the API's response may be found at https://www.yelp.com/developers/documentation/v3/transactions_search
Autocomplete
Returns autocomplete suggestions for search keywords, businesses and categories, based on the input text.
The following example queries the API for autocomplete suggestions using "atomic" for the specified coordinates:
Detail on the API's response may be found at https://www.yelp.com/developers/documentation/v3/autocomplete
Business Details and Reviews
Returns the detailed information or up to 3 reviews of a business. A valid business id is required, and may be obtained via the business, phone, transaction, or autocomplete searches.
The following example will query the API for detailed information on Blue Hill:
The following example will query the API for reviews on Blue Hill:
Detail on the API's responses may be found at
- https://www.yelp.com/developers/documentation/v3/business
- https://www.yelp.com/developers/documentation/v3/business_reviews
Support
Please open an issue for support.
Contributing
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.
License
This is free software distributed under the terms of the MIT license.
About Valiant Technology
Valiant Technology is a Managed Service Provider, focused on the creative and hospitality industries. Our customers include ad agencies, PR firms, app and web developers, TV/Film producers, fashion designers, restaurants and retail. And yes, we also provide support to non-creative firms, provided they enjoy our culture and "click" with our team. Learn more at http://thevaliantway.com.