chriskelemba/event-calendar

Pure PHP calendar event helpers for Google Calendar links and ICS invites.

Maintainers

Package info

github.com/chriskelemba/event-calendar

pkg:composer/chriskelemba/event-calendar

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-04-21 11:54 UTC

This package is auto-updated.

Last update: 2026-04-21 11:55:53 UTC


README

Pure PHP helpers for scheduling an event and exporting it as:

  • a Google Calendar link
  • an .ics file for Apple Calendar, Outlook, Google Calendar imports, and similar apps

The package has no Laravel, Yii, Symfony, or framework dependency, so it can be used in raw PHP or inside any PHP framework.

Installation

composer require chriskelemba/event-calendar

If you are developing it locally first:

cd /Users/Chris/Desktop/event-calendar
composer install
composer test

Basic usage

<?php

require __DIR__ . '/vendor/autoload.php';

use ChrisKelemba\EventCalendar\CalendarInvite;

$invite = CalendarInvite::fromStrings(
    title: 'Project Kickoff',
    startAt: '2026-04-25 09:00:00',
    endAt: '2026-04-25 10:00:00',
    description: 'Initial planning session with the team',
    location: 'Nairobi Office',
    timezone: 'Africa/Nairobi',
);

$googleLink = $invite->googleLink();
$icsContent = $invite->ics();

file_put_contents(__DIR__ . '/kickoff.ics', $icsContent);
echo $googleLink;

Raw PHP download example

<?php

use ChrisKelemba\EventCalendar\CalendarEvent;
use ChrisKelemba\EventCalendar\IcsGenerator;

$event = CalendarEvent::fromStrings(
    'Board Meeting',
    '2026-04-30 14:00:00',
    '2026-04-30 15:00:00',
    'Quarterly business review',
    'Conference Room',
    'Africa/Nairobi'
);

$ics = (new IcsGenerator())->generate($event);

header('Content-Type: text/calendar; charset=UTF-8; method=REQUEST');
header('Content-Disposition: attachment; filename="board-meeting.ics"');

echo $ics;

Laravel / Yii / other frameworks

Create the invite directly from request, DTO, model, or form data:

  • use GoogleCalendarLinkGenerator if you only need a redirect URL
  • use IcsGenerator if you want to attach or download an .ics file
  • use CalendarInvite if you want both

Example flow:

use ChrisKelemba\EventCalendar\CalendarInvite;

$invite = CalendarInvite::fromStrings(
    $data['title'],
    $data['start_at'],
    $data['end_at'],
    $data['description'] ?? null,
    $data['location'] ?? null,
    $data['timezone'] ?? 'UTC',
);

$googleLink = $invite->googleLink();
$icsContent = $invite->ics();

Package structure

  • CalendarEvent: immutable event data object with validation
  • GoogleCalendarLinkGenerator: builds Google Calendar template URLs
  • IcsGenerator: creates RFC-5545 style calendar content
  • CalendarInvite: tiny convenience wrapper that can build the event and generate both outputs