$foursquare = new Client('APPLICATION_ID','APPLICATION_SECRET');
use PDiazDumont\Foursquare\Client;
$foursquare = new Client('APPLICATION_ID','APPLICATION_SECRET');
/*
To perform the process of authentication only when needed, the client provides a helper
method called "isAuthenticated".
*/
if ($foursquare->isAuthenticated()) {
return;
}
/*
The API client must know the redirect URL of the authentication process,
this URL must be equal to the one that is registered in your Foursquare application.
*/
$foursquare->setRedirectUrl('REDIRECT_URL');
/*
The link that the user needs to visit in order to give permission to your application is
generated using the method "getAuthenticationUrl".
*/
$url = $foursquare->getAuthenticationUrl();
header('Location: '. $url);
/*
After the user gives their permission, Foursquare will perform a redirect to the valid Redirect URL
defined in your application, adding a CODE parameter
// Search for a venue
$venues = $foursquare->venues()->search([
'll' => '44.3,37.2',
'near' => 'Chicago, IL'
]);
// Get a list of the trending venues surrounding the user
$trending = $foursquare->venues()->trending([
'll' => '44.3,37.2',
'limit' => 10
]);
// Get a list of categories applied to venues
$categories = $foursquare->venues()->categories();
// Get information about a particular venue
$venue = $foursquare->venues('VENUE_ID')->get();
// Get information about the friends of a particular user
$friends = $foursquare->users('USER_ID')->friends();
// Get information about the checkins of a particular user
$friends = $foursquare->users('USER_ID')->checkins();
// Get information about the current user, note that the id is equal to "self"
$friends = $foursquare->users('self')->friends();
use PDiazDumont\Foursquare\Client;
$foursquare = new Client('APPLICATION_ID','APPLICATION_SECRET');
/* To be able to query all the resources it is necessary to set a valid access token,
this token should be retrieved from a database or other type of storage, considering
that it was obtained previously.
*/
$foursquare->setAccessToken('ACCESS_TOKEN');
// Now everything's ready to perform requests
$data = $foursquare->users('self')->get();
echo "Welcome " . $data['user']['firstName'] . " " . $data['user']['lastName'];
use PDiazDumont\Foursquare\Client;
$foursquare = new Client('APPLICATION_ID','APPLICATION_SECRET');
if ($foursquare->validateUserPush()) {
$data = $foursquare->getUserPushData();
// Do something with the push data.
}
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.