Previous Next
Examples

Introduction

An introduction to PhpiCalLib

Table of Contents

Description

PhpiCalLib is a PHP library that provides an iCalendar parser and object creator. It is object orientated, unit tested, and conforms strictly to the latest iCalendar standard (the successor to RFC2445). The library would have two typical uses:

  1. Parsing an iCalendar file for analysis
  2. Creating an iCalendar file for publication

Note it is not intended that this project will ever provide an iCalendar viewer, rather the target audience is developers who might want to interrogate iCalendar files for custom use in their application, or produce iCalendar files using data from some other data sources like the contents of an sql database.

Why choose PhpiCalLib

There are a lot of software projects in the world now, and it's not always obvious when you should choose to use one. Some might be using the wrong technologies, or even no longer be maintained, others might not be sufficiently complete. Here's some information to help you consider whether to use this project.

Advantages

  • Written in Native PHP: meaning it is easy to install, platform independant, and easy to extend/debug.
  • No dependancies: It is self contained, relying only on core PHP 5 functionality, not part of PEAR or any other class library
  • Strict adherence to the standard: The implementation goes for a strict adherence to the latest standard, soon to be published and obsolete RFC2445. It is worth pointing out that the principle author of PhpiCalLib contributed to the redrafting of RFC2445.
  • Mature design: The architect of the project has experience of writing several parsers, including an iCalendar parser in C++, and has been able to draw from this experience when implementating this one.
  • Extensible design: One specific attribute of the design worth highlighting is that the project has an extensible design. iCalendar has been designed in a way that makes it possible to treat unrecognized entries in a generic way as you would a typically iana-prop or x-prop. Clients can use unrecognized entities using the generic classes, or choose to override the base classes to provide more robust validation.
  • Unit tested: The project has a substantial PHPUnit test suite.

Disadvantages

  • Written in Native PHP: PHP will ultimately have a core compiled extension that provides iCalendar support. This will be faster that a native PHP application ever will be.
  • Performance: By taking a strict view of parsing, the object representation will be larger than it might be with a less object orientated associative array based view of the data. It will also take longer to do all of the strict mostly regular expression based validation of the data.
  • Incomplete: It is likely to remain incomplete, as the author only really took this project on board due to lack of acceptable solutions already out there. While shortcuts won't be taken with the code which is actually needed by the author, until there's actually a need to support VJOURNAL components there's very little chance explicit strict validation will be added. As such many properties/parameters/components are treated as iana-prop/iana-param/iana-comp (unrecognized) would be which means it's pretty much generic validation, store and forward only.

Alternatives

  • PhpiCalendar: Provides an iCalendar viewer, including parser and user interface. The parser from V2.22 consisted of 1222 lines of php source containing precisely zero functions and classes. The whole thing is essentially a set of foreach/while/switch statements and it wasn't remotely clear what the interface to the code was. Presumably setting up various global state variables and then calling include().
  • WebCalendar: Like PhpiCalendar, this also provides an iCalendar parser and user interface, and like PhpiCalendar it's iCalendar parsing code is pretty difficult to work with. In version 1.2.b1 it is nested amongst a 3050 line file, not object orientated, but it did at least separate the file into about 50 functions. The code for constructing iCalendar files is tied to export from it's own schema, rather than generic use, and the code for parsing an iCalendar file returns a poorly documented array object.
  • bennu: There was a lot to like about this project, as the author shares a similar philosophy to PhpiCalLib, but it was last active July 2005, and is very incomplete. There were a number of design flaws including global unscoped functions, and a reliance on calling is_valid_value() on your objects frequently rather than overriding the set() methods to reduce the chance of ending up with invalid values in the first place.
  • iCal Again an excellent attitude to standards compliance, and numerous encouraging comments from peer review, however it was just a PEAR Package Proposal, the files are no longer available for download. The last active comment was June 2005.
  • File_IMC Proposed to parse vCalendar, the predecessor to RFC2445, however downloading the source, for vCalendar it says "nothing has needed parsing so far" compared to vCard, which is ludicrous, and clearly means the project didn't get far.
  • FLP Contains an iCalendar class, but it hasn't been updated since July 2003. Adding an event constituted a function call on the main calendar object that took 22 arguments. It seems obvious to me that those arguments should really be attributes of some class, and an object passed in, but clearly this wasn't obvious to the author of FLP. Likewise the interface was complete, but not extensible, it supported a very specific set of properties, the common ones, but there was a real risk a project would out-grow the capabilities of the class.
  • iCalendar PHP Parser a soureforge project, registered October 2004, yet to release any files

Latest Version

The latest version will be availabe from the project homepage at http://scripts.carrubbers.org

Previous Next
Examples

Documentation generated on Tue, 01 Apr 2008 00:19:49 +0100 by phpDocumentor 1.4.0