PHP code example of davaxi / google_event_template

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

    

davaxi / google_event_template example snippets




t = new Davaxi\Google_Event_Template();
$event->setTimeZone('Europe/Paris');
$event->setStartDate('2016-10-01 12:00:00');
$event->setEndDate('2016-10-01 14:00:00');
$event->setTitle('My Event Title');

$url = $event->getUrl();

printf('<a href="%s" target="_blank">Add event to Google Calendar</a>', $url);



$event = new Davaxi\Google_Event_Template();

// Required fields //

// Event title
$event->setTitle('My Event Title');

// Event timeZone
$event->setTimeZone('Europe/Paris');

// Event start date in specified TimeZone
$event->setStartDate('2016-10-01 12:00:00');

// Event end date in specified TimeZone
$event->setEndDate('2016-10-01 14:00:00');

// Optional fields //
// Event description
$event->setDescription('My Event Description');

// Event Location
$event->setLocation('My Location');

// Set event as busy (true) (default available (false))
$event->eventHasBusy();

// This is not covered by Google help but is an optional 
// parameter in order to add an event to a shared calendar 
// rather than a user's default
$event->setOwnerEmail('[email protected]');
// or 
$event->setOwnerEmail('root@localhost');
 
// Add event Guest email
$event->addGuestEmail('[email protected]');
// or 
$event->addGuestEmail('guest@localhost');

// The documentation says this is to identify the event source.
// It seems to make no difference.
$event->setPropertyName('My Society');

// The documentation says this is to identify the website source.
// It seems to make no difference.
$event->setPropertyWebsite('https://www.mywebsite.com');

// Get Url for add Event
$event->getUrl();