Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
In the absense of namespaces, what is the current methodology to ensure that
the classes I'm developing will not clash with someone else's code?

For now I'm making the class names as 'unique' as possible without losing
the 'intention revealing' aspect of the names.

Are namespaces on the php horizon?

Daniel Klein

[ ps I found (via a google search) a 'namespace petition'. /
It is asking for my email address. Is this site above board? ]

Re: Namespaces

On Tue, 05 Feb 2008 01:46:03 +0100, Daniel Klein  

Quoted text here. Click to load it

There's a PEAR class naming convention:

This however will obviously not cover all, as it's clear more  
natural/logical choices will be used more often by different codes.

For code clearly written for multiple uses / as a module in other code, I  
normally think of a package name, and name all classes:  
<package_name>_<logical_class_name> (so something like class  

Quoted text here. Click to load it

Yup, there's been some toying around with it in the past, and  
implementation seems to be going in PHP5.3 (as will some other OO stuff,  
like late static binding)

Rik Wasmus

Re: Namespaces

Quoted text here. Click to load it

None that is commonly used.  Some developers just ignore the issue,
others prefix "intention-revealing" names with the developer's
(corporate or personal) initials and/or shortened product name.

Quoted text here. Click to load it

Namespaces are available as of PHP 5.3.0 (currently in CVS) on an
experimental basis:


Site Timeline