Yes, it's called PSR-0.
You must write all your code. Usually you will have the name of the provider in which you use the top-level namespace. Your application structure should look something like this.
app/src/Vendor/Accounting/Controllers app/src/Vendor/Job/Controllers
Then your controllers will be replaced accordingly.
namespace Vendor\Accounting\Controllers;
And when using them in routes.
Route::get('accounting/item/{id}','Vendor\Accounting\Controllers\ ItemController@getId ');
Finally, you can register your namespace with Composer in composer.json .
"autoload": { "psr-0": { "Vendor": "app/src" } }
Of course, if you do not want the Vendor top-level namespace to be removed, but you need to register each component as PSR-0.
"autoload": { "psr-0": { "Accounting": "app/src", "Job": "app/src", } }
After execution, run composer dump-autoload once, and you can add new controllers, models, libraries, etc. Just make sure the directory structure matches the namespace of each file.
source share