webcretaire / pig
Simple ICS generator for PHP
Installs: 116
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/webcretaire/pig
Requires (Dev)
- phpunit/phpunit: ^6.2
README
Simple ICS generator for PHP
Usage
When creating a new calendar, you can optionally pass a TZID as a string to the constructor to make sure it will be correctly interpreted (this is highly recommended). The list of supported timezones can be found here
$ics = new PIG\ICS('Europe/Paris'); // For example, or any timezone
Then you just have to put all your events using the addEvent
function
$ics->addEvent( '2018-10-06 20:15:00', // Start '2018-10-07 02:00:00', // End 'Awesome party', // Title 'At my house', // Optionnal location 'Amazing party, with friends and all' // Optionnal description )->addEvent( // You can chain theese calls if you want new \DateTime('2018-10-07 15:00:42'), // Dates can be a \Datetime too new \DateTime('2018-10-07 02:00:00'), 'House cleaning ...' );
Finally to write the file on disk, you need to call the saveICS
function, providing the path you want to write to
$ics->saveICS('path.ics');