Add an admin interface where you can run Laravel commands without the need to SSH into the server.
You can install the package via composer:
composer require zwartpet/command-ui
Publish the assets
php artisan vendor:publish --tag=command-ui-assets
The UI is available on the /command-ui
route, configurable with COMMAND_UI_URI
in your .env
file.
The route is protected with a Laravel Gate named command-ui
which you can customize with COMMAND_UI_GATE
in your .env
file.
Create the gate by adding the following to your AuthServiceProvider
, not adding this will result in a 404 error when visiting the route.
Gate::define('command-ui', function (User $user) {
return $user->isAdmin; // or any other logic
});
This library is plug and play and works out of the box. There are some configuration options available.
The list of commands is filtered by a blacklist or whitelist, by default the blacklist is used.
Publish the configuration to change the lists to your needs.
php artisan vendor:publish --tag=command-ui-config
For all the configuration options see the config file.
Pest
composer test
Pint
composer test:lint
PHPStan
composer test:types
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.