PHP code example of rb-cohen / ical-php
1. Go to this page and download the library: Download rb-cohen/ical-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/ */
rb-cohen / ical-php example snippets
use Ical\Feed;
use Ical\Component\Calendar;
use Ical\Component\Event;
// One feed (i.e. URL) can host more than one caldenar, lets create a feed
$feed = new Feed();
// This calendar will contain our events
$calendar = new Calendar('ical-example//v1');
$event = new Event('uid-1@example');
$event->created(new DateTime('2015-01-01'));
$event->lastModified(new DateTime('2015-01-05'));
$event->between(new DateTime('2015-04-01'), new DateTime('2015-04-01'));
$event->summary('Example of an event');
$event->allDay(true);
// Add this event to the calendar
$calendar->addEvent($event);
// Add the calendar to the feed
$feed->addCalendar($calendar);
// Output the feed with appropriate HTTP header
$feed->output();
exit;