iCalcreator
iCalcreator is a PHP class package managing iCal files, supporting (non-)calendar systems and applications to process and communicate calendar information like events, agendas, tasks, reports, totos and journaling information.
The iCalcreator package, built of a calendar class with support of a function class and helper functions, are calendar component property oriented
iCalcreator features create, parse, edit and select calendar and calendar components.
Knowledge of calendar and rfc2445 is necessary! All functions calls are made as simple as possible BUT (, !!!,) read this rfc properly!
Download iCalcreator here.
Special Offer, Boost performance!!
Howto summary
A short summary how to use iCalcreator; create, parse, edit and output.
CREATE 
CREATE 
require_once( 'iCalcreator.class.php' );
$config = array( 'unique_id' => 'kigkonsult.se' );
// set a (site) unique id
$v = new vcalendar( $config );
// create a new calendar instance
$tz = "Europe/Stockholm";
// define time zone
.. .
$v->setProperty( 'method', 'PUBLISH' );
// required of some calendar software
$v->setProperty( "x-wr-calname", "Calendar Sample" );
// required of some calendar software
$v->setProperty( "X-WR-CALDESC", "Calendar Description" );
// required of some calendar software
$v->setProperty( "X-WR-TIMEZONE", $tz );
// required of some calendar software
.. .
$xprops = array( "X-LIC-LOCATION" => $tz );
// required of some calendar software
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops );
// create timezone component(-s) opt. 1
// based on present date
.. .
$vevent = & $v->newComponent( 'vevent' );
// create an event calendar component
$start = array( 'year'=>2007, 'month'=>4, 'day'=>1, 'hour'=>19, 'min'=>0, 'sec'=>0 );
$vevent->setProperty( 'dtstart', $start );
$end = array( 'year'=>2007, 'month'=>4, 'day'=>1, 'hour'=>22, 'min'=>30, 'sec'=>0 );
$vevent->setProperty( 'dtend', $end );
$vevent->setProperty( 'LOCATION', 'Central Placa' );
// property name - case independent
$vevent->setProperty( 'summary', 'PHP summit' );
$vevent->setProperty( 'description', 'This is a description' );
$vevent->setProperty( 'comment', 'This is a comment' );
$vevent->setProperty( 'attendee', 'attendee1@icaldomain.net' );
.. .
$valarm = & $vevent->newComponent( "valarm" );
// create an event alarm
$valarm->setProperty("action", "DISPLAY" );
$valarm->setProperty("description", $vevent->getProperty( "description" );
// reuse the event description
.. .
$d = sprintf( '%04d%02d%02d %02d%02d%02d', 2007, 3, 31, 15, 0, 0 );
iCalUtilityFunctions::transformDateTime( $d, $tz, "UTC", "Ymd\THis\Z");
$valarm->setProperty( "trigger", $d );
// create alarm trigger (in UTC datetime)
.. .
$vevent = & $v->newComponent( 'vevent' );
// create next event calendar component
$vevent->setProperty( 'dtstart', '20070401', array('VALUE' => 'DATE'));
// alt. date format, now for an all-day event
$vevent->setProperty( "organizer" , 'boss@icaldomain.com' );
$vevent->setProperty( 'summary', 'ALL-DAY event' );
$vevent->setProperty( 'description', 'This is a description for an all-day event' );
$vevent->setProperty( 'resources', 'COMPUTER PROJECTOR' );
$vevent->setProperty( 'rrule', array( 'FREQ' => 'WEEKLY', 'count' => 4));
// weekly, four occasions
$vevent->parse( 'LOCATION:1CP Conference Room 4350' );
// supporting parse of strict rfc2445 formatted text
.. .
// all calendar components are described in rfc2445
// a complete iCalcreator function list (ex. setProperty) in iCalcreator manual
.. .
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops);
// create timezone component(-s) opt. 2
// based on all start dates in events (i.e. dtstart)
.. .
.. .
PARSE 
PARSE 
iCal, rfc5545 / rfc2445
require_once( 'iCalcreator.class.php' );
$config = array( 'unique_id' => 'kigkonsult.se' );
// set the (site) unique id, required if any component UID is missing
$v = new vcalendar( $config );
// create a new calendar instance
/* start parse of local file */
$config = array( 'directory' => 'calendar', 'filename' => 'file.ics' );
$v->setConfig( $config );
// set directory and file name
$v->parse();
/* start parse of remote file */
$v->setConfig( 'url', 'http://www.aDomain.net/file.ics' );
// iCalcreator also support remote files
$v->parse();
$v->setProperty( 'method', 'PUBLISH' );
// required of some calendar software
$v->setProperty( "x-wr-calname", "Calendar Sample" );
// required of some calendar software
$v->setProperty( "X-WR-CALDESC", "Calendar Description" );
// required of some calendar software
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" );
// required of some calendar software
.. .
$v->sort();
// ensure start date order
.. .
xCal, rfc6321 (XML)
require_once( "iCalcreator.class.php" );
$config = array( "unique_id" => "kigkonsult.se" );
// set the (site) unique id, required if any component UID is missing
.. .
$filename = 'xmlfile.xml';
// use a local xCal file
// $filename = 'http://kigkonsult.se/xcal.php?a=1&b=2&c=3';
// or a remote xCal resource
if( FALSE === ( $v = XMLfile2iCal( $filename, $config )))
// convert the XML resource to an iCalcreator instance
exit( "Error when parsing $filename" );
.. .
// continue process (edit, parse,select) the iCalcreator instance
.. .
EDIT 
EDIT 
require_once( 'iCalcreator.class.php' );
$config = array(
'unique_id' => 'kigkonsult.se',
'directory' => 'calendar',
'filename' => 'file.ics' );
// set the (site) unique id, the import directory and file name
$v = new vcalendar( $config );
// create a new calendar instance
$v->parse();
$v->setProperty( 'method', 'PUBLISH' );
// required of some calendar software
$v->setProperty( "x-wr-calname", "Calendar Sample" );
// required of some calendar software
$v->setProperty( "X-WR-CALDESC", "Calendar Description" );
// required of some calendar software
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" );
// required of some calendar software
while( $vevent = $v->getComponent( 'vevent' )) {
// read events, one by one
$uid = $vevent->getProperty( 'uid' );
// uid required, one occurence (unique id/key for component)
.. .
$dtstart = $vevent->getProperty( 'dtstart' );
// dtstart required, one occurence
.. .
if( $description = $vevent->getProperty( 'description', 1 )) {
// description optional, first occurence
.. .
// edit the description
.. .
$vevent->setProperty( 'description', $description, FALSE, 1 );
// update/replace the description
}
while( $comment = $vevent->getProperty( 'comment' )) {
// comment optional, may occur more than once
.. .
// manage comments
}
.. .
while( $vevent->deleteProperty( 'attendee' ))
continue;
// remove all ATTENDEE properties .. .
.. .
$v->setComponent ( $vevent, $uid );
// update/replace event in calendar with uid as key
}
.. .
.. .
// a complete iCalcreator function list
// (ex. getProperty, deleteProperty) in iCalcreator manual
.. .
SELECT 
SELECT 
require_once( 'iCalcreator.class.php' );
$config = array( 'unique_id' => 'kigkonsult.se' );
// set a (site) unique id
$v = new vcalendar( $config );
// create a new calendar instance
$v->setConfig( 'url', 'http://www.aDomain.net/file.ics' );
// iCalcreator also support remote files
$v->parse();
$v->sort();
// ensure start date order
$v->setProperty( 'method', 'PUBLISH' );
// required of some calendar software
$v->setProperty( "x-wr-calname", "Calendar Sample" );
// required of some calendar software
$v->setProperty( "X-WR-CALDESC", "Calendar Description" );
// required of some calendar software
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" );
// required of some calendar software
Select components based on specific date period
$eventArray = $v->selectComponents();
// select components occuring today
// (including components with recurrence pattern)
foreach( $eventArray as $year => $yearArray) {
foreach( $yearArray as $month => $monthArray ) {
foreach( $monthArray as $day => $dailyEventsArray ) {
foreach( $dailyEventsArray as $vevent ) {
$currddate = $event->getProperty( 'x-current-dtstart' );
// if member of a recurrence set,
// returns array( 'x-current-dtstart', <DATE>)
// <DATE> = (string) date("Y-m-d [H:i:s][timezone/UTC offset]")
$dtstart = $vevent->getProperty( 'dtstart' );
// dtstart required, one occurence, (orig. start date)
$summary = $vevent->getProperty( 'summary' );
$description = $vevent->getProperty( 'description' );
.. .
.. .
}
}
}
}
Select specific property values
$valueOccurr = $v->getProperty( 'CATEGORIES' );
// fetch specific property (unique) values and number of occurrences
// ATTENDEE, CATEGORIES, DTSTART, LOCATION, ORGANIZER,
// PRIORITY, RESOURCES, STATUS, SUMMARY, UID
foreach( $valueOccurr as $uniqueValue => $occurr ) {
.. .
}
Select components based on specific property value
$selectSpec = array( 'CATEGORIES' => 'course1' );
$specComps = $v->selectComponents( $selectSpec );
// selects components based on specific property value(-s)
// ATTENDEE, CATEGORIES, LOCATION, ORGANIZER,
// PRIORITY, RESOURCES, STATUS, SUMMARY, UID
foreach( $specComps as $comp ) {
.. .
}
OUTPUT 
OUTPUT 
require_once( 'iCalcreator.class.php' );
$config = array( 'unique_id' => 'kigkonsult.se' );
// set a (site) unique id
$v = new vcalendar( $config );
// create a new calendar instance
$v->setProperty( 'method', 'PUBLISH' );
// required of some calendar software
$v->setProperty( "x-wr-calname", "Calendar Sample" );
// required of some calendar software
$v->setProperty( "X-WR-CALDESC", "Calendar Description" );
// required of some calendar software
$v->setProperty( "X-WR-TIMEZONE", "Europe/Stockholm" );
// required of some calendar software
.. .
.. .// parse calendar file(s) and/or edit/create calendar components.. .
.. .
// opt 1
$v->returnCalendar();
// redirect calendar file to browser
// opt 2
$config = array( 'directory' => 'depot', 'filename' => 'calendar.ics' );
$v->setConfig( $config );
// set output directory and file name
$v->saveCalendar();
// save calendar to (local) file
// opt 3
$xmlstr = iCal2XML( $v );
// create well-formed XML, rfc6321
Create/edit/show iCal/xCal files
You can test iCalcreator online and produce iCal/xCal/rssCal files from a HTML form, eventCreator, create iCal event file on-the-fly, example of how to employ iCalcreator in software development.
An example how to present and display information, tinycal, from iCal files, using iCalcreator class in the server software.
Free images
Click on an image to download. To download all, click here!
News
1/4 2012 New major subrelease of iCalcreator 2.12
| Release summary: | ![]() ![]() |
- Concatenated iCalcreator class, utilityFunction class and helper functions in iCalcreator.class.php file
- new functionality:
external time zone helper function contributions:getTimezonesAsDateArrays (expandTimezoneDates) and getTzOffsetForDate
create and parse of rfc6321 XML
ms2phpTZ, mapping of MS outlook time zones to PHP
createComponent, sorting standard/daylight subComponents - uppdates:
parsing dates with extended (MS outlook) time zones
returnCalendar, only create header 'content-length' when gziping output
_setDate _setDate2, setExdate, setRdate, utc offset management, Z-suffix
createTimezone (_setTZrrule), fixing from/to UTC offset and rdate(-s)
checking x-props names, start with 'x-'/'X-'
parse, management of list content in TEXT properties
all rfc5545 parameters with 'DQUOTE' settings
transformDateTime, accepting input date in array format
property ATTACH and large file attachments - fixed bugs:
selectComponents, (continue if) missing dtstart
selectComponents: long 'event' starting before period setProperty, management of properties with multiple ocurrences
_tz2offset, plus/minus error
getConfig, 'directory' or 'filename' couldn't accept '0' (zero)
_size75, correct line break when property content ends with '0' at pos 76
_setRexrule, UNTIL in DATE format
ATTENDEE, parsing error
setFREEBUSY, empty property
set/create RELATED-TO mgnt
update of PRODID when (re-)setting 'unique_id' - updated user guide
30/12 2011 New release of iCalcnv 3.0
| Release summary: | ![]() ![]() |
- iCalcnv is reworked into a single class, using a simple configuration set method.
- the former main functions; iCal2csv, iCal2xls and cvs2iCal are now public methods in the class.
- an iCalcreator calendar instance can be used as input (iCal2csv, iCal2xls) or returned as output (cvs2iCal) to ease up integration with iCalcreator
- PEAR Log (or eClog) is supported
4/12 2011 New minor subrelease of dbiCal 3.0.5
| Release summary: | ![]() ![]() |
-
new functionality:
Concatenating all class files into one file - updates:
Changed 2nd argument to dbiCal select method: using iCalcreator calendar array config format
admin interface (, when using compare) removing unnecessary parse, sort and save
testing byte encoded class file(-s) - fixed bugs:
admin interface (config tab) when log file is defined but not created
23/11 2011 New subrelease of iCalcreator 2.10.23
| Release summary: | ![]() ![]() |
- fixed bugs:
function selectComponents; RECURRENCE-ID management - updated user guide
UTC timezone usage
relationship between getProperty/selectComponents functions
other minor clarifications
15/11 2011 tinycal 3.0
| Release summary: | ![]() ![]() |
tinycal 3.0, ported to jQuery JavaScript Library v1.4.4 for display and Axaj logics.
14/11 2011 New subrelease of iCalcreator 2.10.20
| Release summary: | ![]() ![]() |
- updates:
xcal (xml) format update
function setConfig (component level), setting 'nl' always before 'format' - fixed bugs:
selectComponents with last arguments (false, true, false)
iCalUtilityFunctions::_recur2date, FREQ=YEARLY + BYDAY - combination
returnCalendar; removing Content-Length header
- updated user guide etc.
21/10 2011 New subrelease of iCalcreator 2.10.15
| Release summary: | ![]() ![]() |
- new functionality:
Evaluate, test and use of ionCube PHP byte file encoder - update of functions
selectComponents, changed order of generating components
setSequence, value 0 (zero) first value
setConfig, force setting of Directory before Filename
_size75, updated management of line folding (again.. .) - fixed bugs:
_size75, typo error
_makeDtstamp, typo error
selectComponents, setting start/end-dates (x-prop) for events longer than 24h - updated using manual
missing links, STATUS etc
8/10 2011 Beta test tinycal 3.0
| Release summary: | ![]() ![]() |
tinycal 3.0, ported to jQuery JavaScript Library v1.4.4 for display and Axaj logics.
Please feel free to take a look and test it here
and use the contact page and communicate your opinion!
Preliminary release date is late October.
7/10 2011 New release of tiCalFile 2.4
| Release summary: | ![]() ![]() |
A file locking mechanism is implemented to avoid parallel excutions.
7/10 2011 New release of eClog 2.0
| Release summary: | ![]() ![]() |
Extended version supporting singleton pattern, simplified log calls etc.
5/8 2011 New subrelease of iCalcreator 2.10.5
| Release summary: | ![]() ![]() |
- new functionality:
transform a datetime from a timezone to another using PHP DateTime and DateTimeZone class (PHP >= PHP 5.2.0) - updates:
parse, ensure (vtimezone) standard/daylight component order
iCalUtilityFunctions::createTimezone, creating RRULEs
iCalUtilityFunctions::_setDate
- fixed bugs:
adaptation for PHP STRICT error_reporting - updated using manual
15/7 2011 New release of iCalcreator 2.10
| Release summary: | ![]() ![]() |
- new functionality:
getProperty, sort, getComponent and selectComponents with new arguments: Attendee, Categories, DTSTAMP, Location, Organizer, Priority, Resources, Status, Summary properties
simple create of timezone (including standard/daylight) component
auto completion of (default) timezone when setting DTEND, DTSTART, DUE, RECURRENCE-ID
new arguments for utf8 encoding and gzencode in function returnCalendar - updates:
get- and setfunction, properties with numeric (integer) content
parse, management of line folding when parsing
getProperty and deleteProperty, management of properties with multiple ocurrence
parse on calendar level, set config when creating new component etc
setfunctions for DTEND, DTSTART, DUE, RECURRENCE-ID
update of getConfig and all config setting on calendar and component level
calendar property VERSION always first in calendar - fixed bugs:
iCalUtilityFunctions::_duration2date
selectComponents
setFreebusy
createAttendee
TRIGGER with no duration
iCalUtilityFunctions::_recur2date(, _setRexrule), BYSETPOS - updated using manual
As usual, exhaustive regression tests has been executed to verify the release as well as external beta testing.
18/6 2011 iCalcreator 2.10 Beta test, Closed
| Summary: | ![]() ![]() |
The iCalcreator 2.10 beta test period has started, if you are interested to have a look and squeeze on iCalcreator v2.10rc2
package, please use the contact page.
Planned official release date is mid July.
- updated management of line folding
- updated functions getProperty, sort, SelectComponents, works with Attendee, Categories, (dtstamp, ) Location, Organizer, Priority, Resources, Status and Summary properties
- simple create of timezone (including standard/daylight) component(-s)
- auto completion of (default) timezone when setting DTEND, DTSTART, DUE, RECURRENCE-ID
-
management of properties with numeric (integer) content; PERCENT-COMPLETE, PRIORITY, REPEAT, SEQUENCE, X-PROP
bug in function iCalUtilityFunctions::_duration2date
bug in function selectComponents
bug in function createAttendee
bug when using TRIGGER with no duration
bug in function SelectComponents regarding X-CURRENT-*-values
bug in function setFreebusy, empty property
bug in function setFreebusy if property is empty.. .
6/3 2011 New release of tiCalFile 2.2
| Release summary: | ![]() ![]() |
- Offer extended property parameter setting.
1/3 2011 New release of dbiCal 3.0
| Release summary: | ![]() ![]() |
After a successfull beta release test period, the official release.
- supporting ALL calendar information; timezone, event, todo, journal and freebusy components with all properties, including x-properties.
- using pear MDB2 as database API and iCalcreator (2.8) as the calendar information API, opt pear Log
- simple interface functions; insert, select and delete calendar information
- includes a web admin page, offering ability to upload, insert, examine (file), inspect (db), removal and compare of calendar files.
- changed licence to LGPL.
28/1 2011 dbiCal 3.0rc2 Beta test
| Summary: | ![]() ![]() |
dbiCal has during the beta tests been extended to
- support storage of metadata, ex. calendar/user references (or preferences)
- include web administrator interface
Please contact if you would like to participarte!
24/1 2011 eventCreator 2.4rc is available for Beta testing.
| Summary: | ![]() ![]() |
16/1 2011 New release of tinycal 2.4.1
| Release summary: | ![]() ![]() |
- adapt for prototype 1.7 javascript framework
- time (date) display in component view
- includes alarms in non-total downloads
9/1 2011 dbiCal 3.0rc Beta test
| Summary: | ![]() ![]() |
dbiCal is a PHP database backend solution storing (multiple) iCal calendar files in a database
using pear MDB2 as database API and iCalcreator 2.8 as the API for calendar information.
Please contact if you would like to participarte!
8/1 2011 New release of tinycal 2.4
| Release summary: | ![]() ![]() |
- The 2.4 version is updated to use iCalcreator 2.8 and javascript adaptations.
- Supports en, fr, it and se languages.
6/1 2011 New release of iCalcreator 2.8
| Release summary: | ![]() ![]() |
- new factory-method for creating components
- simplified configuration
- utility (static) functions collected in support class
- refactored sort and selectComponents functions
- multibyte character support (opt. mb_string)
- value (protocol) prefix (Attendee, Organizer etc.)
- a major number of minor bugs fixed e.g. date (UTC), text properties, duration
- updated using manual
As usual, exhaustive regression tests has been executed to verify the release.


