PHP code example of grinsteindavid / google-calendar
1. Go to this page and download the library: Download grinsteindavid/google-calendar 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/ */
grinsteindavid / google-calendar example snippets
use GrinsteinDavid\GoogleCalendar\Calendar;
use GrinsteinDavid\GoogleCalendar\Event;
$calendar = new Calendar();
$calendar->summary = 'Summer';
$calendar->save();
$event = new Event($calendar->id);
$event->timeZone = "America/New_York";
$event->summary = 'First Event';
$event->startDateTime = date("Y-m-d H:i:s", strtotime('+1 hours'));
$event->endDateTime = date("Y-m-d H:i:s", strtotime('+4 hours'));
$event->save();
foreach ($calendar->events() as $event) {
$event->description = 'Hottest summer!';
$event->save(); // UPDATED BY ATTRS
$event->update([ // UPDATED BY PARAMS
'description' => 'Hottest summer!'
]);
}
$calendar2 = new Calendar($calendarId);
$events = $calendar2->events();
$event = new Event($calendar2->id, $calendar2->events[0]->id);
$event->organizerEmail = '[email protected] ';
$event->organizerName = "David Miranda Grinstein";
$event->guestsCanInviteOthers = true;
$event->guestsCanModify = true;
$event->guestsCanSeeOtherGuests = true;
$event->anyoneCanAddSelf = true;
$event->attendees = [
[
'email' => '[email protected] ',
'displayName' => 'example 1'
],
[
'email' => '[email protected] ',
'displayName' => 'example 2'
]
];
$event->save();
array_push($event->attendees, [
'email' => '[email protected] ',
'displayName' => 'example 3'
]);
$event->save();