PHP Classes

File: readme

Recommend this page to a friend!
  Classes of Andreas Haberstroh  >  IMC Objects  >  readme  >  Download  
File: readme
Role: Documentation
Content type: text/plain
Description: Readme file
Class: IMC Objects
Read and write iCalendar and vCard files
Author: By
Last change:
Date: 14 years ago
Size: 2,024 bytes


Class file image Download
PHP 4.x Based vCard Reader/Writer Class
by Andreas Haberstroh

Ever since I discovered the Internet Mail Consortium website ( and learned 
about vCard and iCalendar files, I've been waiting for a PHP library that could both 
read and write these file formats, along with allowing access to the components and 
properties in a functional manner. Unfortunately, many attempts that have popped up 
on the Internet fall short of usefulness for me. Most classes that I've seen require 
direct access to internal class variables. This requires intense knowledge of the 
format for vCard and iCalendar. I'm a firm believer in encapsulation. So, I cracked 
open the latest RFC's on vCard and iCalendar formats and decided, it's time to 
roll my own.

My class library borrowed from a few of the libraries I found. Mostly, I borrowed 
the parameter parsing code. I used stuff from File_IMC on PEAR, written by 
Marshall Roch <> and Paul Jones <>. I've also borrowed 
code from the vCard PHP project  <>, written by 
Frank Hellwig <>.

These classes are broken into the following hierarchical tree:



imcProperties live inside a imcComponent. The base imcComponent class can also parse 
iCalendar files. I'm currently working on a library to deal with iCalendar files. 

I've included a simple example application called test_vcard.php. This shows using 
the vCard object as a stand alone object, and also parses a simple vcf file and 
displays the results.

For a full blown usage sample, I'd suggest visiting
This sample allows for reading and writing to an addressbook. Storing more than 50 names
in the address book can cause problems, in that the webserver needs to read and parse the
contents of the entire file, even when paging. A better solution would be to store the
data in a database.