itsnubix / nowcal
A modern PHP library for generating iCalendar v2.0 events
Installs: 2 962
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 4
Open Issues: 0
Requires
- php: >8.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^7.1.5|^9.5
README
A modern PHP library for generating iCalendar v2.0 events.
Getting Started
Installation
Install with composer using composer require itsnubix/nowcal
Basic usage
use NowCal\NowCal; $event = NowCal::create(['start' => 'October 5, 2019 6:03PM'])) ->summary('Daft Punk is playing') ->location('My House');
API
Properties
The following properties can be get/set on the NowCal instance. Users can take advantage of the set property helpers in the class, i.e.: $nowcal->location('Event Location');
as they provide a nice syntax to string multiple calls together and support callbacks if necessary.
Methods
$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)