{"id":15063325,"url":"https://github.com/devture/symfony-web-command-bundle","last_synced_at":"2025-04-10T10:50:55.972Z","repository":{"id":62502735,"uuid":"191123119","full_name":"devture/symfony-web-command-bundle","owner":"devture","description":"Symfony bundle that allows console commands to be called from the web in a secure manner","archived":false,"fork":false,"pushed_at":"2024-11-27T12:49:03.000Z","size":15,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T09:38:51.171Z","etag":null,"topics":["console","cron","symfony-bundle","web"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devture.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-10T07:57:06.000Z","updated_at":"2024-11-27T12:49:07.000Z","dependencies_parsed_at":"2025-02-17T02:33:54.290Z","dependency_job_id":"2a8795dc-eb1f-4e30-ada7-12e836e8d1e5","html_url":"https://github.com/devture/symfony-web-command-bundle","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"c6f3779bdb708d9a415e1be3a9d79211741b6dda"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-web-command-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-web-command-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-web-command-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devture%2Fsymfony-web-command-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devture","download_url":"https://codeload.github.com/devture/symfony-web-command-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247895768,"owners_count":21014381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","cron","symfony-bundle","web"],"created_at":"2024-09-24T23:54:59.896Z","updated_at":"2025-04-10T10:50:55.948Z","avatar_url":"https://github.com/devture.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\n\nA Symfony bundle that lets you execute your application's console commands from the web in a secure manner.\n\nThis 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.\nIt can let you convert cronjobs from something like this:\n\n```\n* * * * * user php /app/bin/console ticket:purge\n```\n\nto:\n\n```\n* * * * * user curl -sS -XPOST -H 'Authorization: Bearer SECRET' http://application/web-command/execute/ticket:purge\n```\n\n\n# Installation\n\nInstall through composer (`composer require devture/symfony-web-command-bundle:dev-master`).\n\nAdd to `config/bundles.php`:\n\n```php\nDevture\\Bundle\\WebCommandBundle\\DevtureWebCommandBundle::class =\u003e ['all' =\u003e true],\n```\n\n\n## Configuration\n\nDrop the following routing config in `config/packages/devture_web_command.yaml`\n\n```yaml\ndevture_web_command:\n  auth_token: '%env(DEVTURE_WEB_COMMAND_AUTH_TOKEN)%'\n  forced_uri: '%env(DEVTURE_WEB_COMMAND_FORCED_URI)%'\n```\n\nThe environment variable `DEVTURE_WEB_COMMAND_AUTH_TOKEN` would contain your authentication secret.\nMake it a strong one (e.g. by using `pwgen -Bsv1 64`).\n\nThe 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.\n\n\n## Routing\n\nDrop the following routing config in `config/routes/DevtureWebCommandBundle.yaml`:\n\n```yaml\nDevtureWebCommandBundleWebsite:\n    prefix: /web-command\n    resource: \"@DevtureWebCommandBundle/Resources/config/routes/website.yaml\"\n```\n\n\n## Security\n\nIf using Symfony's Security component to [Secure URL patterns](https://symfony.com/doc/current/security.html#securing-url-patterns-access-control), you may wish to adjust the firewall to not block `/web-command` requests.\n\nModify: `config/packages/security.yaml`:\n\n```yaml\nsecurity:\n  # Other stuff..\n\n  access_control:\n    # Other stuff..\n    - { path: ^/web-command/, role: IS_AUTHENTICATED_ANONYMOUSLY }\n    # Other stuff..\n    - { path: ^/, role: ROLE_USER }\n```\n\n\n# Usage\n\nExecute commands from the web by making a `POST` request to the `/web-command/execute/:commandName` route.\n\nYou need to authenticate using the authentication token provided to the bundle (usually stored in the `DEVTURE_WEB_COMMAND_AUTH_TOKEN` environment variable).\n\nThe basic call would be something like this (using [cURL](https://curl.haxx.se/) for this example):\n\n```\ncurl \\\n-sS \\\n-XPOST \\\n-H 'Authorization: Bearer SECRET' \\\nhttp://application/web-command/execute/commandName\n```\n\nYou can `POST` a JSON payload to this URL endpoint to configure it. Example:\n\n```\n# outputVerbosity = 256 means \"debug\". See the `OutputInterface:VERBOSITY_` constants.\n\ncurl \\\n-sS \\\n-XPOST \\\n-H 'Authorization: Bearer SECRET' \\\n--data '{\"input\": {\"days\": 10, \"--something\": 4}, \"outputVerbosity\": 256}' \\\nhttp://application/web-command/execute/ticket:purge\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevture%2Fsymfony-web-command-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevture%2Fsymfony-web-command-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevture%2Fsymfony-web-command-bundle/lists"}