PHP (PSR-2, anyway) recommends using the vendor name as the root namespace for projects. At face value, this seems to mean we should use the current name of our company. But I work for an enterprise that has been involved in multiple M&As over the years; the name keeps changing, and the old name often still belongs to someone else. I suppose we could just ignore the recommendation and invent some root namespace that is unlikely to conflict with any future strategic forks in the road, but there is value to the recognition that customers have with the name. The problem is, there's also value to the old name from a marketing perspective, too.

On the legal side, sooner or later we will certainly be obligated not to use the old name. But on the technical side, changing the name introduces some risk, too.

I have to change the root namespace of some of our products, eventually. The question is, should I really keep using our (new, at the time) company name as the "vendor" namespace, or is there a better option that can survive future company name changes (ideally, one that doesn't stray too far from the intent of PSR-2)?


The idea is that the namespace is unique, which is why they suggest using your company name (which may have been OK for Sun when they assumed they were too big to ever fail) but it ignores the practicality of M&As or even 2 companies with the same name.

The alternative is to use a GUID but that's impractical for people so you just do what everyone does and puts up with an imperfect solution. Add a product name to the namespace so it adds an extra layer of uniqueness and you should be OK.

As for renaming for legal reasons - it can be considered that the namespace name is part of the product as it was developed and so its OK to continue using it even if the product no longer belongs to the original company. If there is a definite legal reason it has to be changed, then the lawyers will tell you to change it and you take the hit of updating it then. The alternative is to rebrand the product in a major version update.

Its not that big a deal all in all, look in your registry (if you have Windows) and you'll see plenty of entries that reflect the original name of a product (Macromedia Flash for example - bought out in 2005, still used today)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.