I'm looking for a way adding namespaces to the autoload PSR-4-Section in the composer.json file of my Laravel project, from the command line interface.
{
"autoload": {
"psr-4": {
"App\\": "app/",
"Modules\\": "modules/",
/* add more here */
}
}
}
I was hoping there is a command like composer require
, but I've not found a working command for this opportunity.
Did anyone come up with a proper solution for this?
Even a script for bash
, powershell
, php
, ... would be appreciated. Being able to run it from the command line is the main thing.
json_decode()
to convert the composer.json contents to an array, add the namespace definition, andjson_encode()
to convert the adjusted array to json again. This script simply be made executable by usingphp script.php
, in your command line.