itsnubix / nowcal
用于生成iCalendar v2.0事件的现代PHP库
1.3.0
2024-07-17 03:34 UTC
Requires
- php: >8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^7.1.5|^9.5
README
用于生成iCalendar v2.0事件的现代PHP库。
入门指南
安装
使用composer安装:composer require itsnubix/nowcal
基本用法
use NowCal\NowCal; $event = NowCal::create(['start' => 'October 5, 2019 6:03PM'])) ->summary('Daft Punk is playing') ->location('My House');
API
属性
以下属性可以在NowCal实例上获取/设置。用户可以利用类中的设置属性辅助器,例如:$nowcal->location('Event Location');
,它们提供了将多个调用组合在一起的简洁语法,并在必要时支持回调。
方法
$props = [ 'start' => 'now', 'end' => 'now + 1 hour', // OR 'duration' => '28d 6h 42m 12s', 'summary' => 'Daft Punk is playing', 'location' => 'My House', ]; // Creates a NowCal instance $nowcal = new NowCal($props); // or NowCal::create($props); // Exports a raw output array $nowcal->raw; // or NowCal::raw($props) // Exports a plain text version $nowcal->plain; // or NowCal::plain($props) // Exports a path to a tempfile $nowcal->file; // or NowCal::file($props)