Recommended PHP Standards Group

Posted by David in Open Source, PEAR, PHP, industry, innovation
Monday, June 8th, 2009 at 15:03
Introduction
A few weeks ago, Helgi and I attended PHP|Tek 2009 in Chicago, as both representatives of echolibre and The PEAR Group.

This post will briefly discuss the formation of a Recommended PHP Standards Group, as put forward by a meeting of PHP developers at the conference. As would be expected, a bit of controversy surrounds this proposal, but my hope would be that it would be accepted and grow within the global PHP community in the coming years.

As posted by Travis Swicegood, a group of community project representatives came together to discuss naming standards for PHP 5.3 and above. (I would like to take the opportunity to publicly thank the staff of the PHP|Tek conference for providing us with a large meeting room with little more than 2 hours notice).

So, what’s this all about?
With PHP 5.3 being closer to a stable release, the inclusion of namespaces and packaging within projects will take on a whole new meaning for large projects. People representing The PEAR Group (PEAR2), The Zend Framework, Cake PHP, Solar PHP, Agavi and unofficial representatives of Symfony and Phing met together and we discussed standards that could benefit each of the projects and the community in general.

Attending were
Agavi – David Zülke;
Cake – Nate Abele;
PEAR – Brett Bieber, David Coallier, Helgi Þormar Þorbjörnsson, Travis Swicegood;
PhING – Travis Swicegood;
Solar – Paul Jones;
Symfony – Stefan Koopmanschap;
Zend Framework – Matthew Weier O’Phinney;
and the always amiable (i.e., at-large community member), Cal Evans.
Being a PEAR representative with Travis, Helgi and Brett we brought to the table the feedback and problems that we have been facing over the past year and a half with namespacing standards discussions, Matthew Weier O’Phinney from the Zend Framework brought their issues, same for Agavi, Solar, Cake and Symfony (Stefan is an unofficial representative). We brewed and stormed our issues, brought solutions and came up with a standard for namespacing and package structure.

Sneak Preview
Here are a few hints about the standards (outlined on this page) which cover things like namespace packaging structure, exceptions, abstract class naming, interface naming, and concrete class naming.

Namespaces
All packages should be named:
\\

Example:

1
2
3
4
5

Exception Naming
All packages must declare at package level Exception (i.e., pear2\text_diff\Exception)
All packages should use SPL Exceptions where applicable
All of the above mentioned projects consented to this standard as of PHP 5.3. What this means to users and developers is that the barrier for entry from one framework to another becomes greatly reduced and the interoperability of packages between projects is tremendously improved.

You can leave a response, or trackback from your own site.