Download the PHP package devture/symfony-web-command-bundle without Composer
On this page you can find all versions of the php package devture/symfony-web-command-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package symfony-web-command-bundle
Description
A Symfony bundle that lets you execute your application's console commands from the web in a secure manner.
This is useful in environments where you can't run your console commands directly (from cron, etc.), but you can access the application from the web. It can let you convert cronjobs from something like this:
to:
Installation
Install through composer (composer require devture/symfony-web-command-bundle:dev-master
).
Add to config/bundles.php
:
Configuration
Drop the following routing config in config/packages/devture_web_command.yaml
The environment variable DEVTURE_WEB_COMMAND_AUTH_TOKEN
would contain your authentication secret.
Make it a strong one (e.g. by using pwgen -Bsv1 64
).
The environment variable DEVTURE_WEB_COMMAND_FORCED_URI
contains the external URL to your application, so that "console commands" invoked locally (curl http://localhost/web-command/...
) would still generate the correct full URLs. Example value: https://example.com
. It can also be left blank (empty string) to avoid force-setting and rely on auto-detection.
Routing
Drop the following routing config in config/routes/DevtureWebCommandBundle.yaml
:
Security
If using Symfony's Security component to Secure URL patterns, you may wish to adjust the firewall to not block /web-command
requests.
Modify: config/packages/security.yaml
:
Usage
Execute commands from the web by making a POST
request to the /web-command/execute/:commandName
route.
You need to authenticate using the authentication token provided to the bundle (usually stored in the DEVTURE_WEB_COMMAND_AUTH_TOKEN
environment variable).
The basic call would be something like this (using cURL for this example):
You can POST
a JSON payload to this URL endpoint to configure it. Example:
All versions of symfony-web-command-bundle with dependencies
symfony/framework-bundle Version >=4.0,<8.0-dev
symfony/console Version >=4.0,<8.0-dev