Our PHP content repository (PHPCR) implementation ā€œJackalopeā€ is steadily improving. Besides the Jackrabbit backend, there is now also a driver for SQL databases (powered by Doctrine DB abstraction layer) and first work at a MongoDB driver and one for Midgard 1. Midgard 2 will get its own PHPCR implementation not based on Jackalope, and Typo 3 may choose to come back to PHPCR as well. Now is about time to show how to use that API.

Why

PHPCR defines an API to handle semi-structured but hierarchical content in an elegant and consistent way. It combines the best from document-oriented databases (NoSQL) and XML databases (hierarchical trees). Additionally, the API defines search, versioning, access control and other important features.

This is one building block to decouple the cms backend from the frontend. David Nuescheler, the lead of JCR, provides the following advantages of using a content repository

  • Functional Definition of a ā€œContent Repositoryā€
  • Common Vocabulary!
  • No longer learn (dozens of) (ugly) proprietary APIs
  • Write (mostly) portable code, for Document Management, Web Content Management, Source Code Control
  • Compare Repository Functionality
  • No more information silos and vendor Lock-in Content-Centric Infrastructure

A remark for the people interested in the Symfony Content Management Framework initiative: For the CMF you do not need to know how to code PHPCR. There is the Doctrine PHPCR-ODM layer that provides Document classes for yourcontent repository just as the Doctrine ORM abstracts from SQL databases. However, if you want to help us developping the CMF, you should look into the tutorial.

How

I wrote a tutorial that shows how to use PHPCR and explains how to install a playground to experiment with. The API is really simple to use and very expressive for hierarchical but flexible content. After the tutorial, you can take a look at the API documentation and at the full JCR specification.

I am happy to hear your feedback on this tutorial or the whole topic of content repositories.