PHPackages                             moazam1/yelp-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. moazam1/yelp-php

ActiveLibrary[API Development](/categories/api)

moazam1/yelp-php
================

A php client for consuming Yelp API

2.1.0(8y ago)011MITPHPPHP &gt;=5.6.0

Since Oct 21Pushed 7y ago1 watchersCompare

[ Source](https://github.com/moazam1/yelp-php)[ Packagist](https://packagist.org/packages/moazam1/yelp-php)[ Docs](http://github.com/stevenmaguire/yelp-php)[ RSS](/packages/moazam1-yelp-php/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (18)Used By (0)

Yelp PHP Client
===============

[](#yelp-php-client)

[![Latest Version](https://camo.githubusercontent.com/75d7df6afc1137ce9fd83cc840c5cc65918136450862d481c09ab057e6d6bc90/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746576656e6d6167756972652f79656c702d7068702e7376673f7374796c653d666c61742d737175617265)](https://github.com/stevenmaguire/yelp-php/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a02f3057fbe5daa9f88c25aeffaf38d33ee87dfc124145ed3b4facdb3ca53a71/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73746576656e6d6167756972652f79656c702d7068702f6d61737465722e7376673f7374796c653d666c61742d7371756172652631)](https://travis-ci.org/stevenmaguire/yelp-php)[![Coverage Status](https://camo.githubusercontent.com/93d4c7a7197e2e8c5ee3e293d2b826eb097522b34040e71e972568012c02048b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73746576656e6d6167756972652f79656c702d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/yelp-php/code-structure)[![Quality Score](https://camo.githubusercontent.com/f93ed71d8f65487e0541a1e5f4b23720f2d1c5ca4e3090921e8ebf0e4ef246fd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f73746576656e6d6167756972652f79656c702d7068702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/stevenmaguire/yelp-php)[![Total Downloads](https://camo.githubusercontent.com/095d4198864dad06593ac6d39268829c1a0606789d96c0fdc597859f93b9cf6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746576656e6d6167756972652f79656c702d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stevenmaguire/yelp-php)

A PHP client for authenticating with Yelp using OAuth and consuming the API.

Install
-------

[](#install)

Via Composer

```
$ composer require moazam1/yelp-php
```

Usage
-----

[](#usage)

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.

### Create client

[](#create-client)

Each 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.

#### v2 Client Example

[](#v2-client-example)

```
$options = array(
    'consumerKey' => 'YOUR COSUMER KEY',
    'consumerSecret' => 'YOUR CONSUMER SECRET',
    'token' => 'YOUR TOKEN',
    'tokenSecret' => 'YOUR TOKEN SECRET',
    'apiHost' => 'api.yelp.com' // Optional, default 'api.yelp.com'
);

$client = \Stevenmaguire\Yelp\ClientFactory::makeWith(
    $options,
    \Stevenmaguire\Yelp\Version::TWO
);
```

#### v3 Client Example

[](#v3-client-example)

```
$options = array(
    'accessToken' => 'YOUR ACCESS TOKEN', // Required, unless apiKey is provided
    'apiHost' => 'api.yelp.com', // Optional, default 'api.yelp.com',
    'apiKey' => 'YOUR ACCESS TOKEN', // Required, unless accessToken is provided
);

$client = \Stevenmaguire\Yelp\ClientFactory::makeWith(
    $options,
    \Stevenmaguire\Yelp\Version::THREE
);
```

> 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.
>
>

VersionConstantDocumentationv2`Stevenmaguire\Yelp\Version::TWO`[API-GUIDE-v2.md](API-GUIDE-v2.md)v3`Stevenmaguire\Yelp\Version::THREE`[API-GUIDE-v3.md](API-GUIDE-v3.md)### Exceptions

[](#exceptions)

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
$responseBodyObject = json_decode($responseBody);
```

### Advanced usage

[](#advanced-usage)

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.

```
$client = new \Stevenmaguire\Yelp\v3\Client(array(
    'accessToken' => $accessToken,
));

// Create a new guzzle http client
$specialHttpClient = new \GuzzleHttp\Client([
    // ... some special configuration
]);

// Update the yelp client with the new guzzle http client
// then get business data
$business = $client->setHttpClient($specialHttpClient)
    ->getBusiness('the-motel-bar-chicago');

// Create request for other yelp API resource not supported by yelp-php
$request = $client->getRequest('GET', '/v3/some-future-endpoint');

// Send that request
$response = $client->getResponse($request);

// See the contents
echo $response->getBody();
```

Upgrading with Yelp API v2 support from `yelp-php 1.x` to `yelp-php 2.x`
------------------------------------------------------------------------

[](#upgrading-with-yelp-api-v2-support-from-yelp-php-1x-to--yelp-php-2x)

```
// same options for all
$options = array(
    'consumerKey' => 'YOUR COSUMER KEY',
    'consumerSecret' => 'YOUR CONSUMER SECRET',
    'token' => 'YOUR TOKEN',
    'tokenSecret' => 'YOUR TOKEN SECRET',
    'apiHost' => 'api.yelp.com' // Optional, default 'api.yelp.com'
);

// yelp-php 1.x
$client = new Stevenmaguire\Yelp\Client($options);

// yelp-php 2.x - option 1
$client = \Stevenmaguire\Yelp\ClientFactory::makeWith(
    $options,
    \Stevenmaguire\Yelp\Version::TWO
);

// yelp-php 2.x - option 2
$client = new \Stevenmaguire\Yelp\v2\Client($options);
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Steven Maguire](https://github.com/stevenmaguire)
- [All Contributors](https://github.com/stevenmaguire/yelp-php/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 89.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Recently: every ~204 days

Total

16

Last Release

3016d ago

Major Versions

0.0.1 → 1.0.02015-01-11

1.4.3 → 2.0.02017-06-26

PHP version history (2 changes)0.0.1PHP &gt;=5.4.0

2.0.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/a711f524bd345cd7be6ab4e9dc5e03dc9ccf45bdc528c1597e55a6e48bed98c1?d=identicon)[moazam](/maintainers/moazam)

---

Top Contributors

[![stevenmaguire](https://avatars.githubusercontent.com/u/1851973?v=4)](https://github.com/stevenmaguire "stevenmaguire (60 commits)")[![moazam1](https://avatars.githubusercontent.com/u/5168122?v=4)](https://github.com/moazam1 "moazam1 (5 commits)")[![bendavies](https://avatars.githubusercontent.com/u/625392?v=4)](https://github.com/bendavies "bendavies (2 commits)")

---

Tags

phpapioauth2oauth1yelp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/moazam1-yelp-php/health.svg)

```
[![Health](https://phpackages.com/badges/moazam1-yelp-php/health.svg)](https://phpackages.com/packages/moazam1-yelp-php)
```

###  Alternatives

[stevenmaguire/yelp-php

A php client for consuming Yelp API

57396.1k](/packages/stevenmaguire-yelp-php)[noweh/twitter-api-v2-php

This library provides methods for sending messages to Twitter and receiving statuses.

131225.2k1](/packages/noweh-twitter-api-v2-php)[jstolpe/instagram-graph-api-php-sdk

Instagram Graph API PHP SDK

13998.4k2](/packages/jstolpe-instagram-graph-api-php-sdk)[upwork/php-upwork-oauth2

PHP bindings for Upwork API (OAuth2)

153.8k](/packages/upwork-php-upwork-oauth2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
