PHP code example of festivalslab / api-client-php

1. Go to this page and download the library: Download festivalslab/api-client-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/ */

    

festivalslab / api-client-php example snippets


// Require the Composer autoloader.
tFactory;

// Instantiate a Festivals API Client.
$client = FestivalsApiClientFactory::createWithCredentials('key', 'secret');

use FestivalsApi\FestivalsApiClientException;

try {
    $result = $client->searchEvents(['title' => 'Foo']);
    $events = $result->getEvents();
} catch (FestivalsApiClientException $e){
    echo "There was an error: " . $e->getMessage();
}

use FestivalsApi\EventSearchIterator;
use FestivalsApi\FestivalsApiClientException;

$search = new EventSearchIterator($client);
$search->setQuery(['festival' => 'jazz']);
try {
    foreach ($search as $event){
        echo $event['title'];
    }
} catch (FestivalsApiClientException $e){
    echo "There was an error: " . $e->getMessage();
}


bash
composer