Frage

How do you pick a namespace for a project when you're just doing it as an open source project.

As an example I'm developing a library for a government department that are supplying open data. The library will be called RWS.

Two options are gerbenjacobs\RWS or RWS\RWS. So either the name of the developer or the department involved, but neither feel semantically correct. This library is going to be for everyone.

How should I namespace this?

War es hilfreich?

Lösung

If you will develop and maintain this app, use the author prefix, else use a company or department prefix.

\author\software
\author\software\package

\company\software
\company\software\package

Namespace use-cases as examples:

  1. Symfony They use a subnamespace "Component", just to have a clear folder structure.

    namespace Symfony\Component\BrowserKit;

  2. Zend They use Company\Component.

    namespace Zend\Authentication;

But my suggestion would be to use namespace RWS\PackageOne;.

Keep in mind that the namespace reflects your folder structure (PSR)!

Andere Tipps

The one using your name is a pretty safe way of avoiding collisions, at least in the development phase. If no-one can think of a better namespace naming system, leave it as is. Or use a description of what your specific namespace deals with, like email_sorting_module or some such. Don't make problems for yourself.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top