My secret agenda for PHP Content Management Systems
Join the DZone community and get the full member experience.Join For Free
- content model on the browser: vie and rdfa
- content persistence and retrieval: phpcr
- improving performance: appserver-in-php
as i've written before, i'm concerned about the state of the php ecosystem. there are lots of good applications written in the language, but there is very little code sharing between different projects, mainly because of framework incompatibilities, but also because of quite a strong nih culture.
but there are also bright points. i've recently seen lots of exchange of ideas, and even potential code sharing between some communities including symfony2, midgard, typo3 and ez publish. much of the vision in these systems is similar, as are many of the engineering principles. when everybody uses reasonable object-oriented design, namespaces, and test-driven development, it is much easier to share.
if i had to list three areas where there is most potential for collaboration, these would be:
content model on the browser: vie and rdfa
the age of communicating with your web audience via forms is almost over, and it is time to evolve. html5 includes support for the contenteditable attribute which allows rich editing interaction straight on the pages, and there are cool editors supporting that, including aloha editor and mercury .
having rdfa on a page allows the browser to understand the content. what is a collection of blog posts for instance, and what is the title of a blog post. with this, my vie library will provide you with a nice in-browser content management api based on backbone.js . getting there is easy:
this allows a great deal of decoupling in the cms stack . suddenly the server side just has to worry about content management and page generation, and newer in-browser technologies can be used for actual content authoring.
using rdfa annotations in your content comes also with another benefit: suddenly your pages themselves are an api into your content model. and search engines can understand and present your content better.
if you want to learn more about this, watch my talk from the aloha editor dev con.
content persistence and retrieval: phpcr
historically, all cmss have implemented persistence in their own way. there have been systems using relational databases like mysql, systems providing their own content repository apis like midgard, and also some systems just using xml and the file system. this has reduced integration and code re-use possibilities between systems. in the java world, a solution exists for this: the java content repository standard (jcr).
now jcr has been ported to php. phpcr provides a standard interface for all content management needs, and has multiple back-ends available. depending on your deployment needs, you could store your content into a relational database, into apache jackrabbit, or into for example mongodb.
phpcr is great in that you can start small: just model your content with a simple, filesystem-like tree of nodes and properties. then when you need it, a wealth of functionality is available. versioning? query builders? access control? it is all there for you to use. and, depending on the phpcr back-end, you'll have the ability to scale up to insane amounts of content.
while i've advocated using content repositories for years now, this is the first time php has a true standardized, vendor-neutral api for it. and phpcr is even being integrated into the jcr specification , eventually making it an official standard.
adoption is also picking up. yesterday i was in a meeting where we had developers from typo3, symfony2, doctrine and midgard discussing issues and solutions in the content repository space. i just hope the other projects also pick this specification up.
improving performance: appserver-in-php
of the three, this is probably the most controversial idea. traditionally php is run as a scripting environment on a regular web server, like apache or nginx. in such setup, when the server receives a request, it passes it on to the php environment. the php environment loads all the code needed to fulfill the request, runs it, sends the response back, and unloads everything loaded.
this is fine when php is being used in the way rasmus originally intended, as a simple display layer. but nowadays most of php runs on a big framework , whether it is mvc or something custom like drupal. and loading and then discarding a whole framework for each request is simply insane.
with appserver-in-php (aip), you have an environment where even a big framework can perform. aip provides you with a full server environment for php, written in php . in this setup, your framework is loaded when the server boots up, and then each request just runs the request processing part of it.
during the san francisco aloha dev con we ported typo3 to run on aip, and the performance results where staggering. a simpler request with not much i/o would run 3-4 times faster than the same code on regular php setup, and an i/o -intensive request would still be twice as fast . aip can't do much about i/o performance, but at least the cost of having a framework is greatly reduced.
in short, appserver-in-php is something any developer running web services with a php framework should consider. it is also a great way for framework developers to see if they have request isolation problems in their design.
Opinions expressed by DZone contributors are their own.