tiCalFile 3.2

tiCalFile v3.2
copyright (c) 2010-2013 Kjell-Inge Gustafsson, kigkonsult
kigkonsult.se iCalcnv
kigkonsult.se contact


tiCalFile is a PHP class creating iCal (RFC2445) calendar TEST file(-s), a utilization of the iCalcreator class. The purpose of tiCalFile is to always have TEST calendar file(-s) with components (using current date and time), usable when INTERNALLY TESTING calendar software etc.

tiCalFile can be executed from the command line, via a web server/browser, included in other PHP scripts or even from a HTML page, in default or configure modes.

When executing tiCalFile in default mode (below), an iCal test file are created in sub-directory 'calendars' with a timezone and 50 event components, using present start date and nine days forward.

Executing tiCalFile in configure mode (below) offer very flexible setting capabilities:

Calendar component properties DTSTART, SUMMARY, DESCRIPTION, CATEGORIES and RESOURCES are created in every component (where applicable), all other properties appear depending on setting (default 50%) in each component as well as appearence of alarms (with AUDIO, DISPLAY and EMAIL actions). Check a component property list here.

Each property value and parameter contents are based on

Sample test files are validated at
icalvalid.cloudapp.net iCalendar Validator, based on DDay.iCal
severinghaus.org iCalendar Validator, based on iCal4j

To get a proper understanding of iCal, explore the RFC5545 (obsoletes RFC2445), download here.

The tiCalFile are using iCalcreator class, download the latest version here.

The tiCalFile may use PEAR Log, kigkonsult eClog class or no logging.

A file locking mechanism is implemented to avoid parallel excutions and also control ical file(-s) recreate time.


Unpack to any directory within a webserver document root, if not excuting in command line.

Download iCalcreator (required), unzip and place iCalcreator.class.php in the "tiCalFile" directory (FILE LIST below), otherwise change iCalcreator path in php require_once command in "tiCalFile.[cfg/def].php".

When using PEAR LOG (optional), please examine pear.php.net for install and configuration..

Download eClog (optional) and unpack in the "tiCalFile" directory and check (log) directory rights. More Install and configuration information is found in the eClog download package.


The file creation may consume some time (0.2 - 0.4 sec/file), configuration mode and a longer create interval than one hour is to recommend.

Default mode

Examine "tiCalFile.def.php" script. No configuration is done and all default values are used. The test file "calendars/testFile.ics" (relative to the "tiCalFile" directory) will be created or recreated every hour (no file is recreated if the script is reexecuted within an hour). Make sure access/write rights for "calendar" directory.

The created iCal calendar file contains one timezone and 50 event components, starting present day and nine days forward, 5 events every day.

In the "tiCalFile.def.php" script, no logging is enabled.

Examine the created file in the "calendars" directory.

Config mode

Adapt the configuration settings, open "tiCalFile.cfg.php" in an editor and update:

Examine the created file(-s) in the "calendars" folder.

Invoke tiCalFile

Invoke the "tiCalFile.[cfg/def].php" script within another PHP script


tiCalFile in config mode.

.. .
require_once "tiCalFile.cfg.php";
.. .

Execute the "tiCalFile.[cfg/def].php" script from a browser.


tiCalFile in default mode.


Execute the "tiCalFile.[cfg/def].php" script from the command line


tiCalFile in config mode.

php -f ./tiCalFile.cfg.php

Invoke the "tiCalFile.[cfg/def].php" script from a HTML page

Fire of tiCalFile and check/create file(-s) from a HTMl page.

<img src="http://<server>/<path>/tiCalFile-image.php" width="1" height="1" alt="">

Includes a 1*1 px invisible image in a HTML page. The "tiCalFile-image.php" script invokes the "tiCalFile.[cfg/def].php" script. Update the "tiCalFile-image.php" script and comment/uncomment to select the preferred mode.


default calendar directory (configurable), read/write access
this file
HTML "image" back end script
the config "mode" script
the class file
the default "mode" script


Use the contact page for queries, improvement or development issues or professional support and development. Please note that paid support or consulting service has the highest priority.

kigkonsult offer services for software support, design and development of customizations and adaptations of PHP/MySQL solutions with a special focus on software long term utility and reliability, supported through our agile acquire/design/transition process model.


You can show your appreciation for our free software, and can support future development by making a donation to the kigkonsult projects.

Make a donation of any size by clicking the donate link at the contact page . Thanks in advance!



tiCalFile v3.2
copyright (c) 2010-2013 Kjell-Inge Gustafsson, kigkonsult
kigkonsult.se iCalcnv
kigkonsult.se contact


This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA