in java you can have same type of classes and interfaces in same package.
i wonder how you could organize code in this way in php.
have them in different folders?
or use extend on them so you at least can organize them by superclass? (which you could do in java also).
With PHP < 5.3, there is no “real” notion of “package” ; what’s generally done is name classes like this :
Package_Subpackage_MyClassName, and map it to this structure for files and directories :This corresponds to the PEAR Convention, which is widely used, and well accepted :
As long as you follow that convention, you can do pretty much whatever you want — a good idea might be to take a look at the sources of some Open-Source Framework that follow that convention, such as Zend Framework or Doctrine.
With PHP >= 5.3, you have namespaces — which means things might/will change a bit… But, as it’s still quite new, the “best pratices” are not yet well defined nor accepted.
The PSR-0 Final Proposal might be an interesting read, though…