{"id":18879746,"url":"https://github.com/loilo/contao-exec-bundle","last_synced_at":"2026-02-20T04:30:19.340Z","repository":{"id":62518844,"uuid":"200488370","full_name":"loilo/contao-exec-bundle","owner":"loilo","description":"💲 Execute Contao-related PHP code directly from the console","archived":false,"fork":false,"pushed_at":"2020-12-23T23:14:30.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-31T03:12:38.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loilo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-04T12:11:25.000Z","updated_at":"2022-01-25T07:04:53.000Z","dependencies_parsed_at":"2022-11-02T10:32:09.267Z","dependency_job_id":null,"html_url":"https://github.com/loilo/contao-exec-bundle","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcontao-exec-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcontao-exec-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcontao-exec-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcontao-exec-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loilo","download_url":"https://codeload.github.com/loilo/contao-exec-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239841742,"owners_count":19705981,"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":[],"created_at":"2024-11-08T06:39:08.144Z","updated_at":"2026-02-20T04:30:19.271Z","avatar_url":"https://github.com/loilo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Contao Exec\n[![Tests](https://badgen.net/github/checks/loilo/contao-exec-bundle/master)](https://github.com/loilo/contao-exec-bundle/actions)\n[![Version on packagist.org](https://badgen.net/packagist/v/loilo/contao-exec-bundle)](https://packagist.org/packages/loilo/contao-exec-bundle)\n\nThis package allows to execute PHP code in the context of a Contao application, directly from the command line.\n\nIt provides two ways to do so:\n\n* **A [PsySH](http://psysh.org)-based REPL** for tinkering around or getting some quick insight into the state of your Contao project.\n\n* **An [`eval`](https://www.php.net/manual/function.eval.php) command** to get results of a program in a certain data exchange format — useful for getting access to data from outside of Contao.\n\n## Installation\n```bash\ncomposer require loilo/contao-exec-bundle\n```\n\n## Usage\n### REPL\nYou can open up the REPL with the `debug:repl` command:\n\n```bash\nvendor/bin/contao-console debug:repl\n```\n\nThis will throw you into a nice REPL with the Contao framework loaded, all models, DCAs etc. available.\n\nAlso, [the `db()` helper](https://github.com/loilo/contao-illuminate-database-bundle) will be loaded into the namespace automatically if you have it installed, so you can do some quick fiddling right away:\n\n```php\n// Get the URL to the newest page\ndb()-\u003efrom('page')-\u003easModel()-\u003eorderBy('id', 'desc')-\u003efirst()-\u003egetAbsoluteUrl()\n```\n\nAs usual, all options are available via\n\n```bash\nvendor/bin/contao-console help debug:repl\n```\n\n### Eval\nThe `contao:eval` command takes some PHP code, passes it to the REPL and outputs the result.\n\nIf you're using the terminal manually, you probably want to use `debug:repl` instead. However, `contao:eval` can be a great tool to access Contao data from other processes (e.g. Node.js) etc.\n\nTherefore, it does not only have the default `dump` output formatting for human-readable data but also some others, including `json`:\n\n```bash\n# Get ID and title of the newest page as a JSON object\n# This example requires the loilo/contao-illuminate-database-bundle to be installed\nvendor/bin/contao-console contao:eval 'db()\\\n  -\u003efrom(\"page\")\\\n  -\u003eselect(\"id\", \"title\")\\\n  -\u003eorderBy(\"id\", \"desc\")\\\n  -\u003efirst()'\\\n  --format json\\\n  --no-ansi\n\n# \u003e {\"id\":1,\"title\":\"Home\"}\n```\n\nAgain, use `vendor/bin/contao-console help contao:eval` to see what's possible with different options.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fcontao-exec-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floilo%2Fcontao-exec-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fcontao-exec-bundle/lists"}