The specification of autoload of PSR-4 describes how the class should be loaded within your project. In Composer when defining the json we have these two parts:
{ "Namespace\\Base\\" : "diretorio/raiz" }
So, by using this setting in your composer.json
, you allow the rest of the files that will be loaded to have this kind of "prefix".
Example: when making a use Namespace\Base\Http\BaseController
it will include the file diretorio/raiz/http/BaseController.php
in your code.
Some other examples can be seen in specification of PSR-4
Fully Qualified Class Name | Namespace Prefix | Base Directory | Resulting File Path
----------------------------- |--------------------|--------------------------|-------------------------------------------
\Acme\Log\Writer\File_Writer | Acme\Log\Writer | ./acme-log-writer/lib/ | ./acme-log-writer/lib/File_Writer.php
\Aura\Web\Response\Status | Aura\Web | /path/to/aura-web/src/ | /path/to/aura-web/src/Response/Status.php
\Symfony\Core\Request | Symfony\Core | ./vendor/Symfony/Core/ | ./vendor/Symfony/Core/Request.php
\Zend\Acl | Zend | /usr/includes/Zend/ | /usr/includes/Zend/Acl.php