PHPackages                             jcroll/foursquare-api-client - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. jcroll/foursquare-api-client

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

jcroll/foursquare-api-client
============================

PHP Foursquare Api Client built on Guzzle

v3.0.2(9y ago)40104.7k↓50%151MITPHPPHP &gt;=5.5

Since Jul 19Pushed 9y ago3 watchersCompare

[ Source](https://github.com/jcroll/foursquare-api-client)[ Packagist](https://packagist.org/packages/jcroll/foursquare-api-client)[ Docs](https://github.com/jcroll/foursquare-api-client)[ RSS](/packages/jcroll-foursquare-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (3)Versions (14)Used By (1)

JcrollFoursquareApiClient
=========================

[](#jcrollfoursquareapiclient)

[![Build Status](https://camo.githubusercontent.com/48199e5021b5d18484a1cbd31c482ec1a28c8248071b1c8648dd526f810ef692/68747470733a2f2f7472617669732d63692e6f72672f6a63726f6c6c2f666f75727371756172652d6170692d636c69656e742e706e67)](https://travis-ci.org/jcroll/foursquare-api-client)[![Total Downloads](https://camo.githubusercontent.com/486fff6802646b51ca265ac532dc78d4d0d3fc7bb660eeb845c166968875a5ad/68747470733a2f2f706f7365722e707567782e6f72672f6a63726f6c6c2f666f75727371756172652d6170692d636c69656e742f646f776e6c6f616473)](https://packagist.org/packages/jcroll/foursquare-api-client)[![Monthly Downloads](https://camo.githubusercontent.com/27d40b2c7e68b814d346b7a4a6755d2c3d169892b0d31ddd7b6e9c0722f101af/68747470733a2f2f706f7365722e707567782e6f72672f6a63726f6c6c2f666f75727371756172652d6170692d636c69656e742f642f6d6f6e74686c79)](https://packagist.org/packages/jcroll/foursquare-api-client)[![Latest Stable Version](https://camo.githubusercontent.com/f64a9d8336fc49743832e0a7d6f8a81cb2d0385f5afcb1f2c904b836d68aeeb6/68747470733a2f2f706f7365722e707567782e6f72672f6a63726f6c6c2f666f75727371756172652d6170692d636c69656e742f762f737461626c65)](https://packagist.org/packages/jcroll/foursquare-api-client)[![License](https://camo.githubusercontent.com/d13c2d7308de773e3bc358bcab11392687210ec7f77d17dd85e4c14a8d6c4380/68747470733a2f2f706f7365722e707567782e6f72672f6a63726f6c6c2f666f75727371756172652d6170692d636c69656e742f6c6963656e7365)](https://packagist.org/packages/jcroll/foursquare-api-client)

Find the [Symfony Bundle for this library here](https://github.com/jcroll/foursquare-api-bundle).

Why?
----

[](#why)

There is no library currently built to interact with the [foursquare api](https://developer.foursquare.com/) using the fantastic [Guzzle HTTP Client library](https://github.com/guzzle/guzzle). Guzzle is awesome and supplies a lot of great things for building web service clients. Guzzle is fully unit tested which allows this library to be a light wrapper around the Guzzle core. You can read more [about Guzzle here](http://guzzlephp.org/).

Installation
------------

[](#installation)

The JcrollFoursquareApiClient is available on Packagist ([jcroll/foursquare-api-client](https://packagist.org/packages/jcroll/foursquare-api-client)) and as such installable via [Composer](http://getcomposer.org/).

If you do not use Composer, you can grab the code from GitHub, and use any PSR-4 compatible autoloader (e.g. the [Symfony ClassLoader component](https://github.com/symfony/ClassLoader)) to load the library's classes.

### Guzzle Versioning

[](#guzzle-versioning)

This package is compatible with different versions of Guzzle (see below):

Guzzle VersionFoursquare Client Version~3~1~4, ~5~2~6~3### Composer example

[](#composer-example)

Add JcrollFoursquareApiBundle in your composer.json:

```
{
    "require": {
        "jcroll/foursquare-api-client": "~3"
    }
}
```

Download the library:

```
$ php composer.phar update jcroll/foursquare-api-client
```

After installing, you need to require Composer's autoloader somewhere in your code:

```
require_once 'vendor/autoload.php';
```

Usage
-----

[](#usage)

```
use Jcroll\FoursquareApiClient\Client\FoursquareClient;

$client = FoursquareClient::factory([
    'client_id'     => 'your_foursquare_client_id',     // required
    'client_secret' => 'your_foursquare_client_secret', // required
    'version'       => 20140806,                        // optional
    'mode'          => 'foursquare',                    // optional (one of 'foursquare' or 'swarm')
]);

$client->setToken($oauthToken);  // optionally pass in for user specific requests

$client->setMode('swarm');       // switch from mode 'foursquare' to 'swarm'

$command = $client->getCommand('venues/search', [
    'near'  => 'Chicago, IL',
    'query' => 'sushi'
]);

$results = (array) $client->execute($command); // returns an array of results
```

You can find a list of the client's available commands in the bundle's [client.json](https://github.com/jcroll/foursquare-api-client/tree/master/src/Resources/config/20160901/client.json) but basically they should be the same as the [api endpoints listed in the docs](https://developer.foursquare.com/docs/).

Oauth Integration
-----------------

[](#oauth-integration)

Endpoints in the foursquare API that are user specific will require authorization with foursquare using the Oauth 2.0 protocol.

If you're using the [HWIOAuthBundle](https://github.com/hwi/HWIOAuthBundle) with Symfony you can install the [JcrollFoursquareApiBundle](https://github.com/jcroll/foursquare-api-bundle) for automatic integration with your oauth requests.

Otherwise oauth protocol authorization is beyond the scope of this library but you can find a list of possible libraries [here](https://packagist.org/search/?q=oauth). After authorization you can pass the access token into the client for user specific access.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 93.9% 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 ~108 days

Recently: every ~40 days

Total

13

Last Release

3386d ago

Major Versions

v1.1.1 → v2.0.02016-08-26

v2.1.1 → v3.0.02016-12-29

PHP version history (3 changes)v1.1.1PHP &gt;=5.3.3

v2.0.0PHP &gt;=5.4

v3.0.0PHP &gt;=5.5

### Community

Maintainers

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

---

Top Contributors

[![jcroll](https://avatars.githubusercontent.com/u/1441013?v=4)](https://github.com/jcroll "jcroll (93 commits)")[![itavero](https://avatars.githubusercontent.com/u/203398?v=4)](https://github.com/itavero "itavero (3 commits)")[![feulf](https://avatars.githubusercontent.com/u/540035?v=4)](https://github.com/feulf "feulf (1 commits)")[![hpatoio](https://avatars.githubusercontent.com/u/249948?v=4)](https://github.com/hpatoio "hpatoio (1 commits)")[![jbboehr](https://avatars.githubusercontent.com/u/225601?v=4)](https://github.com/jbboehr "jbboehr (1 commits)")

---

Tags

apiclientoauthfoursquareswarm

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jcroll-foursquare-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/jcroll-foursquare-api-client/health.svg)](https://phpackages.com/packages/jcroll-foursquare-api-client)
```

###  Alternatives

[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

194.1k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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