itsnubix/nowcal

用于生成iCalendar v2.0事件的现代PHP库

1.3.0 2024-07-17 03:34 UTC

This package is auto-updated.

Last update: 2024-09-17 04:01:23 UTC


README

Software License Total Downloads

用于生成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)