Download the PHP package phpfui/icalendar without Composer
On this page you can find all versions of the php package phpfui/icalendar. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpfui/icalendar
More information about phpfui/icalendar
Files in phpfui/icalendar
Package icalendar
Short Description A modern fork of the icalendar.org PHP implementation of rfc5545, management of iCal formatted files
License GPL-3.0-or-later
Homepage https://icalendar.org/php-library.html
Informations about the package icalendar
Zap Calendar iCalendar Library
A modern 7.4 namespaced fork of Zap Calendar iCalendar Library
The Zap Calendar iCalendar Library is a PHP library for supporting the iCalendar (RFC 5545) standard.
This PHP library is for reading and writing iCalendar formatted feeds and files. Features of the library include:
- Read AND write support for iCalendar files
- Object based creation and manipulation of iCalendar files
- Supports expansion of RRULE to a list of repeating dates
- Supports adding timezone info to iCalendar file
All iCalendar data is stored in a PHP object tree. This allows any property to be added to the iCalendar feed without requiring specialized library function calls. With power comes responsibility. Missing or invalid properties can cause the resulting iCalendar file to be invalid. Visit iCalendar.org to view valid properties and test your feed using the site's iCalendar validator tool.
Library API documentation can be found at http://icalendar.org/zapcallibdocs and PHPFUI/ICalendarOrg
See the examples folder for programs that read and write iCalendar files. Best to include the sample files into a file with an active autoloader or include all the classes to run the examples directly.
Create an ical object using the ZCiCal object:
Add an event object:
Add a start and end date to the event:
Write the object in iCalendar format using the export() function call:
This example will not validate since it is missing some required elements. Look at the simpleevent.php example for the minimum # of elements needed for a validated iCalendar file.
To create a multi-event iCalendar file, simply create multiple event objects. For example:
To read an existing iCalendar file/feed, create the ZCiCal object with a string representing the contents of the iCalendar file:
Large iCalendar files can be read in chunks to reduce the amount of memory needed to hold the iCalendar feed in memory. This example reads 500 events at a time:
You can read the events from an imported (or created) iCalendar object in this manner:
Known Limitations
- Since the library utilizes objects to read and write iCalendar data, the size of the iCalendar data is limited to the amount of available memory on the machine. The ZCiCal() object supports reading a range of events to minimize memory space.
- The library ignores timezone info when importing files, instead utilizing PHP's timezone library for calculations (timezones are supported when exporting files). Imported timezones need to be aliased to a PHP supported timezone.
- At this time, the library does not support the "BYSETPOS" option in RRULE items.