alkhachatryan/laravel-web-console
Laravel Web Console adds a browser-based Artisan console to your Laravel app, letting authorized users run commands and view output without SSH. It includes configurable access controls, command history, and a responsive terminal-style interface for quick debugging and maintenance.
Install the package with Composer. It is archived (last release October 2020), so treat installation as a compatibility exercise first:
composer require alkhachatryan/laravel-web-console
Laravel 5.5+ should auto-discover Alkhachatryan\LaravelWebConsole\LaravelWebConsoleServiceProvider. On older versions, register the provider manually in config/app.php. Then publish the package config and frontend assets:
php artisan vendor:publish --provider="Alkhachatryan\LaravelWebConsole\LaravelWebConsoleServiceProvider"
Open config/web-console.php first. It controls the route/path, middleware, and authorization behavior. The default setup typically exposes a /web-console route behind web and auth middleware, but you should confirm the exact keys in your published config rather than assuming defaults.
Before visiting the console, define the authorization gate in app/Providers/AuthServiceProvider.php:
use Illuminate\Support\Facades\Gate;
public function boot()
{
Gate::define('viewWebConsole', function ($user) {
return $user->is_admin; // or an explicit email/role check
});
}
Then visit /web-console (or your configured path) as an authenticated user who passes the gate.
The first practical use case is read-only inspection: run route:list, migrate:status, config:show (where available), cache:clear, or queue:failed from the browser instead of SSHing into a staging box. It is best treated as an internal admin convenience, not a production shell.
Lock it to an admin surface. Put the console behind your existing admin middleware stack and gate, and link to it from an admin navigation area. A typical config override:
// config/web-console.php
return [
'route' => 'admin/web-console',
'middleware' => ['web', 'auth', 'can:viewWebConsole'],
];
Confirm the actual config keys in the published file; the important part is that both authentication and authorization are enforced at the route level, not only in the UI.
Use it for discrete Artisan operations. The console executes Artisan commands, not shell commands. Good day-to-day candidates are:
migrate, migrate:rollback, migrate:statusdb:seed --class=...cache:clear, config:clear, route:clear, view:clearroute:list, event:list, queue:failedmake:model, make:controller, make:migrationAvoid anything interactive or long-running: tinker, queue:work, serve, and large migrations belong in a real terminal.
Add an audit trail. Wrap the console route with custom middleware that logs the authenticated user, timestamp, IP, and command payload. Since the package ultimately receives a command string and returns output, logging at the middleware/controller boundary gives you accountability without modifying vendor code.
Restrict by environment and network. For local and staging, a simple gate is enough. For any shared environment, combine the gate with an IP allowlist or VPN-only access. A common pattern is to return false from the gate when app()->environment('production'), and enable it only for named operators.
Gate::define('viewWebConsole', function ($user) {
return app()->environment(['local', 'staging'])
&& $user->hasRole('operator');
});
Publish and customize the views sparingly. If you need to add a warning banner, command history, or a link back to your admin dashboard, publish the package views and override them. Keep customizations minimal because the package is unmaintained and upstream updates are unlikely.
Use it as a diagnostic companion, not a deployment tool. The strongest workflow is: deploy through CI, then use the web console for post-deploy checks such as migrate:status, config:clear, route:list, and cache warm-up verification. Keep destructive or schema-changing operations in a controlled CLI or CI pipeline.
composer.json constraints before installing; if Composer blocks the install, prefer a fork or a maintained alternative over --ignore-platform-reqs in production.ls, cd, git status, php -v, and composer install will not work. The console runs through Laravel's Artisan layer.tinker, queue:work, serve, and commands that wait for input will block the HTTP request until PHP or the web server times out. Use a real terminal for those.web middleware group for session and CSRF handling. If you replace middleware, keep web or manually ensure the CSRF token is sent. In browser dev tools, a 419 response usually means CSRF/session configuration is wrong.viewWebConsole gate is missing or returns a non-boolean, expect a 403. Verify with php artisan route:list and by temporarily logging inside the gate closure.vendor:publish command again and check that the package's public assets exist under public/vendor/.... Also check the browser network tab for 404s on JS/CSS.config/web-console.php, run php artisan config:clear. If routes are cached, re-cache after any route-related config change, and confirm the console route appears in route:list.--no-ansi where supported.migrate or db:wipe, and avoiding destructive commands from the browser on shared environments.max_execution_time or your reverse proxy timeout, leaving the browser request open with no feedback. Use the CLI for anything that may take more than a few seconds.composer.json.storage/logs/laravel.log, inspect the AJAX request/response in the browser network tab, run php artisan route:list | grep -i console, and verify the gate with a quick Gate::allows('viewWebConsole') check in a test or Tinker session.How can I help you explore Laravel packages today?