PHP code example of erwane / openagenda-api

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

    

erwane / openagenda-api example snippets


composer 

composer 

use OpenAgenda\OpenAgenda;
use OpenAgenda\Wrapper\GuzzleWrapper

// PSR-18 Http client.
$guzzleOptions = ['timeout'  => 2.0];
$wrapper = new GuzzleWrapper($guzzleOptions);

// PSR-16 Simple cache. Optional
$cache = new Psr16Cache();

// Create the OpenAgenda client. The public key is e' => $cache, // Optional
    'defaultLang' => 'fr', // Optional
]);

$agendas = $oa->myAgendas(['limit' => 2]);
$agenda = $oa->agendas(['slug' => 'agenda-slug'])->first();

// Search
$locations = $oa->locations(['agendaUid' => 123, 'name' => 'My Location']);
// Exists and get
$exists = $oa->location(['uid' => 456, 'agendaUid' => 123])->exists();
$location = $oa->location(['uid' => 456, 'agendaUid' => 123])->get();
// Create
$location = $oa->location($data)->create();

// Search
$events = $oa->events(['agendaUid' => 123, 'title' => 'My event']);
// Exists and get
$exists = $oa->event(['uid' => 456, 'agendaUid' => 123])->exists();
$event = $oa->event(['uid' => 456, 'agendaUid' => 123])->get();
// Create
$event = $oa->event($data)->create();