PHP code example of apility / netflex-calendar-sync

1. Go to this page and download the library: Download apility/netflex-calendar-sync 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/ */

    

apility / netflex-calendar-sync example snippets


/*
  First option is the calendar ID.
  Second option is the API key, 
  Third option is an associative array of key values found in the Google API documentation
*/
$calendar = new GoogleCalendar($openingHourEntry->calendarId, \get_setting("google_calendar_sync_api_key"), [
  'singleEvents' => true,
]);

$openingHours = $calendar
  ->map(function($event) {
    return [
      "eventId" => $event->id,
      "name" => "Åpningstid",
      "start" => Carbon::parse($event->start->dateTime)->format(DateTime::ISO8601),
      "end" => Carbon::parse($event->end->dateTime)->format(DateTime::ISO8601),
      "allDay" => false,
    ];
  });


$resolver = new EntrySync(Models\Calendar::find(10000));
$resolver->syncData($openingHours);