chriskelemba/event-calendar
最新稳定版本:v1.1.0
Composer 安装命令:
composer require chriskelemba/event-calendar
包简介
Pure PHP calendar event helpers for Google Calendar links and ICS invites.
README 文档
README
Pure PHP helpers for scheduling an event and exporting it as:
- a Google Calendar link
- an
.icsfile 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
GoogleCalendarLinkGeneratorif you only need a redirect URL - use
IcsGeneratorif you want to attach or download an.icsfile - use
CalendarInviteif 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 validationGoogleCalendarLinkGenerator: builds Google Calendar template URLsIcsGenerator: creates RFC-5545 style calendar contentCalendarInvite: tiny convenience wrapper that can build the event and generate both outputs
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-21