org_heigl / calendar-aggregator
Aggregate iCalendar and CalDav calendars
0.2.0
2017-03-29 19:44 UTC
Requires
- org_heigl/trait-iterator: ^1.0
- roave/security-advisories: dev-master
- sabre/vobject: ^4.1
Requires (Dev)
- mockery/mockery: ^0.9.9
- phpunit/phpunit: ^6.0
This package is auto-updated.
Last update: 2024-11-23 10:06:36 UTC
README
Aggregate iCalendar and CalDav calendars
Usage
$aggregator = new Aggregator(); $aggregator->add(new Icalendar('https://example.com/icalendar')); // $aggregator->add(new CalDav('https://example.com/caldav')); $range = $aggregator->getRange( new DateTimeImmutable('2017-01-01'), new DateTimeImmutable('2018-01-01') ); foreach ($range as $event) { echo sprintf( 'Event %s starts %s and ends %s', $event->getTitle, $event->getStart()->format('c'), $event->getEnd()->format('c') ); }
Alternatively you can also retrieve the events in "lanes" where each lane contains a list of non-overlapping events.
$aggregator = new Aggregator(); $aggregator->add(new Icalendar('https://example.com/icalendar')); // $aggregator->add(new CalDav('https://example.com/caldav')); $range = $aggregator->getRange( new DateTimeImmutable('2017-01-01'), new DateTimeImmutable('2018-01-01') ); foreach ($range->getLanes() as $lane) { foreach ($lane as $event) { echo sprintf( 'Event %s starts %s and ends %s', $event->getTitle, $event->getStart()->format('c'), $event->getEnd()->format('c') ); } }