Skip to content

trq/foursquare-api-bundle

 
 

Repository files navigation

JcrollFoursquareApiBundle

Build Status

This bundle integrates the JcrollFoursquareApiClient into the Symfony2 framework.

Why?

There is no library built to interact with the foursquare api using the fantastic Guzzle HTTP Client library. Guzzle is awesome and supplies a lot of great things for building web service clients.

Installation

Add JcrollFoursquareApiBundle in your composer.json:

{
    "require": {
        "jcroll/foursquare-api-bundle": "1.0.*"
    }
}

Download bundle:

$ php composer.phar update jcroll/foursquare-api-bundle

Add the JcrollFoursquareApiBundle to your AppKernel.php

// app/AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            ...
            new Jcroll\FoursquareApiBundle\JcrollFoursquareApiBundle(),
            ...
        );
        ...
    }

Basic configuration

Add your application id and secret parameters:

# app/config/config.yml

jcroll_foursquare_api:
    client_id:     <your_foursquare_client_id>
    client_secret: <your_foursquare_client_secret>

Usage

$client = $this->container->get('jcroll_foursquare_client');
$client->addToken($oauthToken); // optional for user specific requests
$command = $client->getCommand('venues/search', array(
    'near' => 'Chicago, IL',
    'query' => 'sushi'
));
$results = $command->execute();

You can find a list of the client's available commands in the bundle's client.json but basically they should be the same as the api endpoints listed in the docs.

Oauth2 Integration

Authorization for user specific requests at foursquare via the Oauth 2 protocol is beyond the scope of this bundle. Here are two libraries you might use to do that:

After you receive your access token you can then pass it into the client as shown above.

About

Symfony2 bundle for the jcroll/foursquare-api-client: https://github.com/jcroll/foursquare-api-client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%