{"id":17932578,"url":"https://github.com/stevenmaguire/yelp-php","last_synced_at":"2025-10-14T04:47:50.421Z","repository":{"id":22166531,"uuid":"25498219","full_name":"stevenmaguire/yelp-php","owner":"stevenmaguire","description":"A php client for consuming Yelp API","archived":false,"fork":false,"pushed_at":"2018-12-12T21:39:19.000Z","size":100,"stargazers_count":56,"open_issues_count":3,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-03T23:49:55.014Z","etag":null,"topics":["oauth1","oauth2","php","yelp","yelp-api"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stevenmaguire.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-21T02:40:24.000Z","updated_at":"2024-09-29T22:47:29.000Z","dependencies_parsed_at":"2022-08-19T23:41:00.445Z","dependency_job_id":null,"html_url":"https://github.com/stevenmaguire/yelp-php","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenmaguire%2Fyelp-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenmaguire%2Fyelp-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenmaguire%2Fyelp-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevenmaguire%2Fyelp-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevenmaguire","download_url":"https://codeload.github.com/stevenmaguire/yelp-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047646,"owners_count":20389206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["oauth1","oauth2","php","yelp","yelp-api"],"created_at":"2024-10-28T21:28:07.797Z","updated_at":"2025-10-14T04:47:45.402Z","avatar_url":"https://github.com/stevenmaguire.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Yelp PHP Client\n\n[![Latest Version](https://img.shields.io/github/release/stevenmaguire/yelp-php.svg?style=flat-square)](https://github.com/stevenmaguire/yelp-php/releases)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Build Status](https://img.shields.io/travis/stevenmaguire/yelp-php/master.svg?style=flat-square\u00261)](https://travis-ci.org/stevenmaguire/yelp-php)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/stevenmaguire/yelp-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/stevenmaguire/yelp-php/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/g/stevenmaguire/yelp-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/stevenmaguire/yelp-php)\n[![Total Downloads](https://img.shields.io/packagist/dt/stevenmaguire/yelp-php.svg?style=flat-square)](https://packagist.org/packages/stevenmaguire/yelp-php)\n\nA PHP client for authenticating with Yelp using OAuth and consuming the API.\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require stevenmaguire/yelp-php\n```\n\n## Usage\n\nThis 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.\n\n### Create client\n\nEach version of the Yelp API maps to a different client, as the APIs are very different. A client factory is available to create appropriate clients.\n\n#### v2 Client Example\n\n```php\n$options = array(\n    'consumerKey' =\u003e 'YOUR COSUMER KEY',\n    'consumerSecret' =\u003e 'YOUR CONSUMER SECRET',\n    'token' =\u003e 'YOUR TOKEN',\n    'tokenSecret' =\u003e 'YOUR TOKEN SECRET',\n    'apiHost' =\u003e 'api.yelp.com' // Optional, default 'api.yelp.com'\n);\n\n$client = \\Stevenmaguire\\Yelp\\ClientFactory::makeWith(\n    $options,\n    \\Stevenmaguire\\Yelp\\Version::TWO\n);\n```\n\n#### v3 Client Example\n\n```php\n$options = array(\n    'accessToken' =\u003e 'YOUR ACCESS TOKEN', // Required, unless apiKey is provided\n    'apiHost' =\u003e 'api.yelp.com', // Optional, default 'api.yelp.com',\n    'apiKey' =\u003e 'YOUR ACCESS TOKEN', // Required, unless accessToken is provided\n);\n\n$client = \\Stevenmaguire\\Yelp\\ClientFactory::makeWith(\n    $options,\n    \\Stevenmaguire\\Yelp\\Version::THREE\n);\n```\n\n\u003e Prior to December 7, 2017 `accessToken` was required to authenticate requests. Since then, `apiKey` is the preferred authentication method. This library supports both `accessToken` and `apiKey`, prioritizing `apiKey` over `accessToken` if both are provided.\n\u003e\n\u003e https://www.yelp.com/developers/documentation/v3/authentication#where-is-my-client-secret-going\n\nVersion | Constant | Documentation\n--------|----------|--------------\nv2 | `Stevenmaguire\\Yelp\\Version::TWO` | [API-GUIDE-v2.md](API-GUIDE-v2.md)\nv3 | `Stevenmaguire\\Yelp\\Version::THREE` | [API-GUIDE-v3.md](API-GUIDE-v3.md)\n\n##### Get Rate Limit data from most recent request\n\nFor the v3 client, [rate limiting data](https://www.yelp.com/developers/documentation/v3/rate_limiting) is avaiable after a recent request.\n\n```php\n// $latestRateLimit will be null if an http request hasn't been successfully completed.\n$latestRateLimit = $client-\u003egetRateLimit();\n\n// The maximum number of calls you can make per day\n$latestDailyLimit = $latestRateLimit-\u003edailyLimit;\n\n// The number of calls remaining within the current day\n$latestRemaining = $latestRateLimit-\u003eremaining;\n\n// The time at which the current rate limiting window will expire as an ISO 8601 timestamp\n$latestResetTime = $latestRateLimit-\u003eresetTime;\n\n// The time at which the current rate limiting data was observed as an ISO 8601 timestamp\n$latestCreatedAt = $latestRateLimit-\u003ecreatedAt;\n```\n\n### Exceptions\n\nIf 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.\n\n```php\n$responseBody = $e-\u003egetResponseBody(); // string from Http request\n$responseBodyObject = json_decode($responseBody);\n```\n\n### Advanced usage\n\nBoth 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.\n\n```php\n$client = new \\Stevenmaguire\\Yelp\\v3\\Client(array(\n    'accessToken' =\u003e $accessToken,\n));\n\n// Create a new guzzle http client\n$specialHttpClient = new \\GuzzleHttp\\Client([\n    // ... some special configuration\n]);\n\n// Update the yelp client with the new guzzle http client\n// then get business data\n$business = $client-\u003esetHttpClient($specialHttpClient)\n    -\u003egetBusiness('the-motel-bar-chicago');\n\n// Create request for other yelp API resource not supported by yelp-php\n$request = $client-\u003egetRequest('GET', '/v3/some-future-endpoint');\n\n// Send that request\n$response = $client-\u003egetResponse($request);\n\n// See the contents\necho $response-\u003egetBody();\n```\n\n## Upgrading with Yelp API v2 support from `yelp-php 1.x` to  `yelp-php 2.x`\n\n```php\n// same options for all\n$options = array(\n    'consumerKey' =\u003e 'YOUR COSUMER KEY',\n    'consumerSecret' =\u003e 'YOUR CONSUMER SECRET',\n    'token' =\u003e 'YOUR TOKEN',\n    'tokenSecret' =\u003e 'YOUR TOKEN SECRET',\n    'apiHost' =\u003e 'api.yelp.com' // Optional, default 'api.yelp.com'\n);\n\n\n// yelp-php 1.x\n$client = new Stevenmaguire\\Yelp\\Client($options);\n\n// yelp-php 2.x - option 1\n$client = \\Stevenmaguire\\Yelp\\ClientFactory::makeWith(\n    $options,\n    \\Stevenmaguire\\Yelp\\Version::TWO\n);\n\n// yelp-php 2.x - option 2\n$client = new \\Stevenmaguire\\Yelp\\v2\\Client($options);\n```\n\n## Testing\n\n``` bash\n$ ./vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [Steven Maguire](https://github.com/stevenmaguire)\n- [All Contributors](https://github.com/stevenmaguire/yelp-php/contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenmaguire%2Fyelp-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevenmaguire%2Fyelp-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevenmaguire%2Fyelp-php/lists"}