phil / calendar-import
Keep a calendar in step with external iCalendar feeds: read by URL on a schedule, changes found, the last good state kept when a feed fails, editor edits kept.
Package info
github.com/parler-haut-interagir-librement/calendar-import
pkg:composer/phil/calendar-import
Requires
- php: >=8.5
- ext-intl: *
- ext-mbstring: *
- phil/recurrence: ^0.1@dev
- phil/safe-http: ^0.2@dev
- phil/url: ^0.1@dev
- psr/clock: ^1.0
- symfony/http-client-contracts: ^3.8
Requires (Dev)
- phpunit/phpunit: ^13.4
- symfony/clock: ^8.2
- symfony/http-client: ^8.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-30 02:41:39 UTC
README
Keep a calendar in step with external iCalendar feeds: read by URL on a schedule, changes found, the last good state kept when a feed fails, editor edits kept.
phil/calendar-import is a plain PHP library. It reads iCalendar feeds (RFC 5545) strictly and within bounds, through
phil/safe-http, and tells what changed since the last read: events added, changed and removed. A feed that fails
keeps its last good state; an editor's changes to an imported event survive every read. What comes out are neutral
drafts, marked with their source and their UID, that an application turns into its own calendar's events.
Status
| Part | State |
|---|---|
ICalendarReader, ReaderLimits, Rejection |
Implemented and tested |
EventSource, IcsUrlSource, CalendarSource, FetchValidators |
Implemented and tested |
Snapshot, SnapshotDiff, SourceState, RefreshPolicy |
Implemented and tested |
EditorOverride, CalendarImporter, ImportedDraft |
Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements and installing. |
| Reading iCalendar | What the reader accepts and refuses, time zones, bounds. |
| Sources | The EventSource port, the feed read by URL, conditional reads, security. |
| Refreshing a source | Snapshots, differences, failures, the refresh policy, editor overrides, drafts. |
| Extension points | The ports, and the adapter that writes drafts to a calendar. |
| Testing | The package's tests, its fuzz target and its benchmark. |
| Reference | Every public type, with its role. |
Quick start
composer require phil/calendar-import
use Phil\CalendarImport\CalendarImporter; use Phil\CalendarImport\Source\CalendarSource; use Phil\CalendarImport\Source\IcsUrlSource; use Symfony\Component\Clock\NativeClock; $importer = new CalendarImporter(IcsUrlSource::create(), $stateStore, $overrideStore, new NativeClock()); $outcome = $importer->refresh(CalendarSource::of('library-events', 'webcal://calendar.example.org/public.ics', 'America/Toronto')); foreach ($outcome->changes as $change) { // $change->kind: Added, Changed or Removed; $change->draft: an ImportedDraft }
$stateStore and $overrideStore implement the library's two storage ports; the library itself keeps nothing between
two requests.
Requirements
PHP 8.5 or later, with intl and mbstring.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.