PHP code example of thevaliantway / yelp-php

1. Go to this page and download the library: Download thevaliantway/yelp-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thevaliantway / yelp-php example snippets


$id        = YELP_ID
$secret    = YELP_SECRET
$yelpCreds = TVW\Yelp::bearerRequest($id, $secret);

// parameters for testing
$searchParams = [
    "location"      => "10001",
    "radius"        => "500",
    "sort_by"       => "distance",
    "categories"    => "restaurants",
    "limit"         => 5
];
$yelpFusion = new Yelp(API_TOKEN);
$results    = $yelpFusion->searchBusiness($testParams);

$yelpFusion = new Yelp(API_TOKEN);
$results    = $yelpFusion->searchPhone("+12127527470");

$transactionParams = [
    "latitude"      => "40.730610",
    "longitude"     => "-73.935242"
];
$yelpFusion = new Yelp(API_TOKEN);
$result     = $yelpFusion->searchTransaction("delivery", $transactionParams);

$autoCompleteParams = [
    "text"          => "atomic",
    "latitude"      => "40.730610",
    "longitude"     => "-73.935242"
];
$yelpFusion = new Yelp(API_TOKEN);
$results    = $yelpFusion->autoComplete($autoCompleteParams);

$yelpFusion = new Yelp(API_TOKEN);
$result     = $yelpFusion->getDetails("details", blue-hill-new-york");

$yelpFusion = new Yelp(API_TOKEN);
$result     = $yelpFusion->getDetails("reviews", blue-hill-new-york");