Just override ArtisanServiceProvider, for example:
create a new provider will be called ProductionArtisanServiceProvider
php artisan make:provider ProductionArtisanServiceProvider
Open a new provider and change it to the following
namespace App\Providers; use Illuminate\Foundation\Providers\ArtisanServiceProvider as IlluminateProvider; class ProductionArtisanServiceProvider extends IlluminateProvider { protected $devCommands = [ 'AppName' => 'command.app.name', ]; }
You see above, I override $ devCommands for a complete list
take a look inside Illuminate \ Foundation \ Providers \ ArtisanServiceProvider
Finally, you have the AppServiceProvider in the register function, add a new provider and make sure that it is loaded only in the production environment
if ($this->app->environment() == 'production') { $this->app->register(\App\Providers\ProductionArtisanServiceProvider::class); }
Now all unnecessary commands are gone
source share