定制 chriskelemba/event-calendar 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 .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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-21