Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Home

rodneyrehm edited this page · 5 revisions
Clone this wiki locally

CFPropertyList

The PHP implementation of Apple's PropertyList can handle XML PropertyLists as well as binary PropertyLists. It offers functionality to easily convert data between worlds, e.g. recalculating timestamps from unix epoch to apple epoch and vice versa. A feature to automagically create (guess) the plist structure from a normal PHP data structure will help you dump your data to plist in no time.

What's a PList?

PropertyList are means to store data in a flexible yet robust manner. The standard was defined by Apple and is thus in heavy use throughout the Apple Macintosh Operation System. Any application not using a database will most likely store its data the way Mac OS X handles its preferences and settings - with simple plist files.

With the uprise of the iPhone PropertyLists now also serve as a means to transfer data from the web to iPhone applications. Because (file)size does matter PropertyLists are not only available in (the pretty verbose) XML format, but also in a very compact binary form.

XML vs. Binary

Where the XML based plist can be handled by any system or language by their built-in XML APIs, the binary plist cannot. With CFPropertyList one can handle XML based and binary plists without even noticing a difference at all. CFPropertyList offers an abstract API to create and manipulate PropertyLists, while offering functionality to read and write PHP array structures, XML based plists, binary based plists and of course any combinations of the former.

plist vs. PHP

There are some pitfalls regarding plists and PHP. Where PHP's internal timestamps are unix epoch (seconds since 01.01.1970 00:00:00), plists rely on the Apple epoch (seconds since 01.01.2001 00:00:00). CFPropertyList will automatically translate between unix and apple epoch, if you don't tell it otherwise.

Choose Your Favorite Operating System

CFPropertyList does not rely on any "Apple proprietary" components, like plutil. CFPropertyList runs on any Operating System with PHP and some standard extensions installed.

Although you might want to deliver data to your iPhone application, you might want to run those server side services on your standard Linux (or even Windows) environment, rather than buying an expensive Apple Server. With CFPropertyList you now have the power to provide data from your favorite Operating System.

Requirements And Limitations

  • requires PHP5 (tested with PHP5.2.9 and 5.3.0 on Mac, PHP5.2.1 on Windows)
  • requires either MBString or Iconv
  • requires either BC or GMP or phpseclib (see BigIntegerBug for an explanation) - as of CFPropertyList 1.0.1

Related Sites

Something went wrong with that request. Please try again.