https://github.com/itsnubix/nowcal
A modern PHP library for generating iCalendar v2.0 events.
https://github.com/itsnubix/nowcal
ical icalendar ics php-library
Last synced: 3 months ago
JSON representation
A modern PHP library for generating iCalendar v2.0 events.
- Host: GitHub
- URL: https://github.com/itsnubix/nowcal
- Owner: itsnubix
- License: mit
- Created: 2019-02-08T22:39:05.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-12T03:50:06.000Z (6 months ago)
- Last Synced: 2025-05-29T17:17:03.548Z (4 months ago)
- Topics: ical, icalendar, ics, php-library
- Language: PHP
- Homepage:
- Size: 65.4 KB
- Stars: 9
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# NowCal
[](LICENSE)
[](https://packagist.org/packages/itsnubix/nowcal)A modern PHP library for generating iCalendar v2.0 events.
## Getting Started
### Installation
Install with composer using `composer require itsnubix/nowcal`
### Basic usage
```php
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.
| Property | Description |
|----------|-------------------------------------------------------------------------------------------------------------------------------------|
| uid | A globally unique ID. NOTE: passing the same ICS file into a calendar app with the same UI allows you to update the existing invite |
| start | A string parseable by DateTime |
| timezone | A string parseable by DateTimeZone |
| end | A string parseable by DateTime, as per RFC 5545, only an end value or duration value may be used |
| duration | A string parseable by DateInterval, as per RFC 5545, only an end value or duration value may be used |
| summary | A short description of the event |
| location | The location where the event is taking place |
| sequence | An integer that represents the version number |
| method | send if required, publish/cancel/etc |
| reminder | A simple display reminder. A string parseable by DateInterval. |### Methods
```php
$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)
```