PHP code example of mattmy / laravel-icalendar-reader
1. Go to this page and download the library: Download mattmy/laravel-icalendar-reader 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/ */
mattmy / laravel-icalendar-reader example snippets
use Mattmy\ICalendar\Facades\ICalendar;
$calendar = ICalendar::read(<<<'ICS'
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example//Calendar//EN
BEGIN:VEVENT
UID:[email protected]
DTSTAMP:20260803T000000Z
DTSTART:20260810T090000Z
SUMMARY:Project meeting
END:VEVENT
END:VCALENDAR
ICS);
$event = $calendar->events()->sole();
echo $event->summary; // Project meeting
echo $event->startsAt?->toIso8601String(); // 2026-08-10T09:00:00+00:00
use Mattmy\ICalendar\Facades\ICalendar;
$calendar = ICalendar::read($contents);
$calendar = ICalendar::fromPath($path);
$calendar = ICalendar::fromStream($stream);
$calendar = ICalendar::fromUploadedFile($uploadedFile);
$events = $calendar->events('[email protected] ');
$event = $calendar->event('[email protected] ');
$todos = $calendar->todos();
$journals = $calendar->journals();
$journal = $calendar->journal('[email protected] ');
$eventsInRange = $calendar->eventsBetween($from, $until);
$occurrences = $calendar->occurrencesBetween($from, $until);
$freeBusy = $calendar->component('VFREEBUSY');
$customProperty = $calendar->property('X-CUSTOM');
$json = $calendar->toJson(JSON_PRETTY_PRINT);
use Mattmy\ICalendar\Exceptions\InvalidCalendar;
use Mattmy\ICalendar\Facades\ICalendar;
try {
$calendar = ICalendar::read($contents);
} catch (InvalidCalendar $exception) {
$issues = $exception->issues();
}
$warnings = $calendar->warnings();