Skip to content

ben-gibson/foursquare-venue-client

Repository files navigation

Foursquare Venue API Client

Join the chat at https://gitter.im/foursquare-venue-client/Lobby

Latest Version on Packagist Software License Build Status Total Downloads

A PHP client library for interacting with the Foursquare userless venue API. HTTPlug is used to support multiple HTTP clients including Guzzle, Buzz, and Curl.

Install

Use composer to install this library and your preferred HTTP client.

$ composer require php-http/guzzle6-adapter
$ composer require ben-gibson/foursquare-venue-client

Usage

<?php

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

use Gibbo\Foursquare\Client\Client;
use Gibbo\Foursquare\Client\Configuration;
use Gibbo\Foursquare\Client\Entity\Coordinates;
use Gibbo\Foursquare\Client\Factory\Venue\VenueFactory;
use Gibbo\Foursquare\Client\Identifier;
use Gibbo\Foursquare\Client\Options\Search;

$client = Client::simple(new Configuration('client-id', 'client-secret'), VenueFactory::simple());

// Get by id
$venue = $client->getVenue(new Identifier('430d0a00f964a5203e271fe3'));

$venue->getName();
$venue->getDetails()->getRating();

// Search by coordinates
$options = Search::coordinates(new Coordinates(28.538336, -81.379234))
    ->limit(10)
    ->radius(500)
    ->query('Donuts');

$venues = $client->search($options);

// Search by place
$options = Search::place('Chicago, IL')
    ->limit(10)
    ->radius(500)
    ->query('Donuts');

$venues = $client->search($options);

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email ben.gibson.2011@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.