Search code examples
phpopen-sourcenamespaces

PHP - starting to use namespaces


Can you provide me the name of a good (easy-to-analyze) open-source project(-s) that use namespaces instead of PEAR file structure naming conventions?

I'm willing to start using namespaces in my project, but I don't really know how should I handle this in the best possible way, e.g.:

Autoloading class will autoload my internal classes using namespaces, but what about autoloading 3rd party modules which don't use namespaces, or namespaces mirroring its file structure? Should I create two separate classes, or handle this behaviour in a single class?

Flexible file structure - how to name namespaces there? Let's have a namespace in system/ folder like: System/Foo/Bar. But what if someone changes the name of the system/ folder into something else and the namespace will remain the same?

And so on...


Solution

  • PSR-0 is one the few standards we have in PHP.

    There's lots of examples in the internet, here's some: