MIT License

项目介绍

markuspoerschke/iCal 是一个托管在 GitHub 上的开源项目,主要使用 PHP 编写,采用 MIT License 许可证,目前获得 1.2k 个 Star、169 次 Fork。

仓库全名
markuspoerschke/iCal
开源许可证
MIT License
Star 数
1.2k
Fork 数
169
未关闭 Issue
77

README 摘要

📅 eluceo — iCal 2 This package offers an abstraction layer for creating iCalendars files. By using this PHP package, you can create .ics files without the knowledge of the underling format. The output itself will follow RFC 5545 as good as possible. Navigate through the project 📖 read the documentation 🐛 report a bug or suggest a feature 🙋 raise a question 💬 start a discussion Installation You can install this…

完整内容见 GitHub 原始 README 或本页 。

常见问题

iCal 用什么语言开发?

主要使用 PHP 编写,采用 MIT License 许可证,目前有 1.2k 个 Star。

iCal 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 iCal 的源码?

可以直接克隆仓库:git clone https://github.com/markuspoerschke/iCal.git;安装与运行步骤见仓库 README。

iCal 最近还在维护吗?

仓库最近一次更新为 5月9日,当前有 77 个未关闭 Issue;Star 数为 1.2k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

iCal-creator for PHP

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
2682
价值分
867
活跃状态
活跃

语言占比

CSS
JavaScript
Makefile
PHP

Release

README

📅 eluceo — iCal 2

Continuous Integration codecov Psalm coverage License Latest Stable Version Monthly Downloads Infection MSI

This package offers an abstraction layer for creating iCalendars files. By using this PHP package, you can create *.ics files without the knowledge of the underling format. The output itself will follow RFC 5545 as good as possible.

Installation

You can install this package by using Composer, running the following command:

composer require eluceo/ical

Version / Upgrade

The initial version was released back in 2012. The version 2 of this package is a complete rewrite of the package and is not compatible to older version. Please see the upgrade guide if you want to migrate from version 0.* to 2.*. If you just start using this package, you should install version 2.

Version PHP Version
>= 2.16 8.4 - 8.5
2.15 8.3 - 8.4
< 2.14 7.4 - 8.3
0.16.* 7.0 - 8.2
0.11.* 5.3.0 - 7.4

Documentation

Visit ical.poerschke.nrw for complete documentation.

Usage

The classes within this package are grouped into two namespaces:

  • The Domain contains the information about the events.
  • The Presentation contains the transformation from Domain into a *.ics file.

To create a calendar, the first step will be to create the corresponding domain objects. Then these objects can be transformed into a iCalendar PHP representation, which can be cast to string.

Empty event

In this very basic example, that renders an empty event. You will learn how to create an event domain object, how to add it to a calendar and how to transform it to a iCalendar component.

1. Create an event domain entity
$event = new \Eluceo\iCal\Domain\Entity\Event();
2. Create a calendar domain entity
$calendar = new \Eluceo\iCal\Domain\Entity\Calendar([$event]);
3. Transform calendar domain object into a presentation object
$iCalendarComponent = (new \Eluceo\iCal\Presentation\Factory\CalendarFactory())->createCalendar($calendar);
4. a) Save to file
file_put_contents('calendar.ics', (string) $iCalendarComponent);
4. b) Send via HTTP
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');

echo $iCalendarComponent;

Full example

The following example will create a single day event with a summary and a description. More examples can be found in the examples/ folder.

<?php

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

// 1. Create Event domain entity
$event = (new Eluceo\iCal\Domain\Entity\Event())
    ->setSummary('Christmas Eve')
    ->setDescription('Lorem Ipsum Dolor...')
    ->setOccurrence(
        new Eluceo\iCal\Domain\ValueObject\SingleDay(
            new Eluceo\iCal\Domain\ValueObject\Date(
                \DateTimeImmutable::createFromFormat('Y-m-d', '2030-12-24')
            )
        )
    );

// 2. Create Calendar domain entity
$calendar = new Eluceo\iCal\Domain\Entity\Calendar([$event]);

// 3. Transform domain entity into an iCalendar component
$componentFactory = new Eluceo\iCal\Presentation\Factory\CalendarFactory();
$calendarComponent = $componentFactory->createCalendar($calendar);

// 4. Set headers
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename="cal.ics"');

// 5. Output
echo $calendarComponent;

License

This package is released under the MIT license.

评论

暂无评论