A simple PHP ical parser, that allows to pass in a URL to an ics file and get all event details.
For a client project I needed a simple way to read a ics file from a google calendar.
- PHP
- HTML
Please find an example implementation of the ical parser in the index.php file.
To use the ical parser you need to include the files ical/ical.php and ical/icalEvent.php into your project.
Create a new instance of the iCal class and pass the URL to the ics file into the constructor.
$calendar = new iCal("https://calendar.google.com/calendar/ical/de.german%23holiday%40group.v.calendar.google.com/public/basic.ics");
You can get either all future events or all currently active events as follows:
Future events
$icsEvents = $calendar->getEventsAfterDate(date('Y-m-d'));
Active events
$icsEvents = $calendar->getActiveEvents();