winzou/console-bundle
Symfony bundle that simplifies integrating the Console component into your application, making it easy to register and run custom CLI commands with service container support. A lightweight helper for building and organizing command-line tooling in Symfony projects.
Add the bundle for development only:
composer require --dev winzou/console-bundle
Register it in app/AppKernel.php, gated to the dev environment so it can never be loaded in production:
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Winzou\Bundle\ConsoleBundle\WinzouConsoleBundle();
}
Import its routing (usually under a dev-only prefix, or behind a firewall):
# app/config/routing_dev.yml
winzou_console:
resource: "@WinzouConsoleBundle/Resources/config/routing.xml"
prefix: /console
Then open /console in the browser and type a command such as cache:clear or doctrine:schema:validate.
Look first at: the Winzou\Bundle\ConsoleBundle\Controller\ConsoleController (the indexAction renders the terminal UI; the command action resolves the Application and executes the command) and the routing XML — that shows you exactly which commands are reachable and under which HTTP method.
First use case: running cache:clear, assets:install, and doctrine:schema:update on a shared host or a sandbox where you have no SSH. It's a convenience wrapper around Symfony's Application, so any command your kernel can discover (core + your bundles) is available without typing a full shell invocation.
Command discovery is automatic. The bundle boots a Symfony Console\Application against your kernel, so every command registered in your bundles appears. To add a bespoke "run in the browser" command, create a normal command class in your bundle; nothing extra is needed for it to show up in the console.
Lock it behind the firewall. The safest pattern is to register the bundle only in dev and restrict the route. Combine the dev-only bundle registration with a firewall rule (or an access_control entry) requiring ROLE_ADMIN or a local IP check:
access_control:
- { path: ^/console, roles: ROLE_ADMIN, ip: 127.0.0.1 }
Wrap common tasks as custom commands instead of typing raw ones. If your team uses the console daily for repetitive operations (fixtures, imports, cache warmup), define thin custom Commands that encapsulate the arguments, then invoke them from the browser. This keeps the browser surface small — one command per workflow, with no user-supplied options.
Debug commands for the dev loop. Good candidates: cache:clear, cache:warmup, doctrine:cache:clear-metadata, assets:install, router:debug, debug:container. Anything interactive (e.g. doctrine:fixtures:load --no-interaction needed) or destructive should get an equivalent non-interactive custom command.
Non-interactive only. The controller executes commands via the standard Application, but there is no TTY, so anything that prompts (doctrine:fixtures:load asking to confirm, generate:controller asking questions) will fail or hang. Prefer commands that accept --no-interaction, -n, or all options as flags. Build your custom commands to read configuration rather than prompt.
Output shape. The console streams plain text back to the browser via AJAX; ANSI escape codes will show up as literal garbage. If your custom commands emit progress or formatted tables, keep them simple, or strip colour codes (OutputInterface::OUTPUT_PLAIN / --no-ansi) before they reach the browser.
Environment control. To run a command against another environment (e.g. clearing the prod cache from a dev box), the console lets you pass --env=prod, but remember the PHP process still runs with the dev kernel's services. Where possible, run commands with explicit flags so the behaviour is reproducible from the command line as well.
Application construction differs and the bundle will not boot. Treat it as a legacy tool for existing Symfony 2 apps.$input->isInteractive() and waits for input will block until the PHP/web-server timeout. Use --no-interaction and pre-built flags.cache:clear and doctrine:schema:update on a large app can exceed PHP's max_execution_time or nginx/FPM timeouts; the browser request dies with a 504 while the command may have partially completed. Run potentially long commands through a queue instead, or at least keep the console for short operations.debug:container, large fixture loads) can exhaust memory limits. Prefer targeted commands over debug:* on large containers.app/cache / app/logs ownership for the FPM/CLI user before blaming the console.--dev. Install it as a dev dependency and exclude it from production deploys (composer install --no-dev). If the bundle is conditionally registered in the kernel, the app still boots in prod without the class present.How can I help you explore Laravel packages today?