On 7/6/15 3:52 AM, Jason Judge wrote:
> On Sunday, 5 July 2015 14:33:35 UTC+1, Moshe Brevda wrote:
>
> *NameOfOrganization*would be your**"vendor namespace",
Correct. Most PSR-4 compatible autoloaders don't enforce global
uniqueness or that the top level namespace is in some magic "vendor"
list. They just work by string mangling and you're fine.
The purpose of the vendor level is to encourage interoperability by,
effectively, making all classes in the PHP world have a GUID class
name. That makes "this class is already loaded, what are you trying to
do?" problems go away almost entirely (unless you're doing some specific
hacking of autoload ordering, in which case you're on your own).
The top level namespace could be a company name, project name, or the
developer's name/handle. The point is to NOT assume that your project
is the entire universe, even if it is app-specific code. Thus,
\Controller, \Form, \User, etc. as in effect your app trying to lay
claim to the entire universe of Controllers, Forms, and Users. You
likely don't mean that. :-)
One of the advantages of PSR-4 over PSR-0 is that you can have that
extra namespace layer for your application without needing to have an
otherwise-useless directory on disk to click through every time you want
to get to your code. That's the point. :-) You can have your vendor and
not-navigate it too.
--
--Larry Garfield