Vendor names in PHP namespaces

Since an increasing number of PHP projects are going to use namespaces, it gets more important to agree on a scheme which avoids naming conflicts. The current best practice is to use the "vendor name" as the top level namespace โ€“ but who says that your vendor name is unique?

The approach of FLOW3 was โ€“ until now โ€“ to force all its packages to use a schema like "F3\PackageKey\Foo\Bar\..." for the naming of their classes. In order to keep the package key unique, we force suggest that developers register a package at This essentially allows us to guarantee that each fully qualified class name is unique world wide.

This approach would work fine within the TYPO3 / FLOW3 universe, but what we really want is to foster code reuse and collaboration among other PHP projects. The PSR0 standard initiative was certainly a good step into this direction and the suggestion by Fabien (ie. essentially to put not any real restrictions on the namespace as long as the top level part is the vendor name) is the way to go. Following the current best practice I'd like FLOW3 to support class names like \[Vendor]\Foo\Bar\Baz. In case of Fluid that would be a namespace like \FLOW3\Package\Fluid (because Fluid is a project of the FLOW3 team). The actual Doctrine2 code would reside somewhere in the \Doctrine\... namespace (Doctrine project is the vendor) whilst a possible Doctrine2 wrapper for FLOW3 would be put into a namespace like \FLOW3\Package\Doctrine2.

The big question now is: how can we achieve that the vendor name is almost certainly unique? For its bundles, Symfony2 currently establishes the best practice to use the Github user name as its vendor name. But in the TYPO3 / FLOW3 project we don't use Github as we have our own servers at If I would start using "RL" as a vendor name, it is not unlikely that someone will do the same. Even with "RobertLemke" I wouldn't be on the safe side.

Do we need a schema or registry for vendor names?

Leave a reply