PHPackages                             loilo/contao-exec-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. loilo/contao-exec-bundle

ActiveContao-bundle[CLI &amp; Console](/categories/cli)

loilo/contao-exec-bundle
========================

Execute Contao-related PHP code directly from the console

1.0.3(6y ago)118MITPHPPHP &gt;= 7.1CI failing

Since Aug 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/loilo/contao-exec-bundle)[ Packagist](https://packagist.org/packages/loilo/contao-exec-bundle)[ RSS](/packages/loilo-contao-exec-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Contao Exec
===========

[](#contao-exec)

[![Tests](https://camo.githubusercontent.com/a380f0cbbaf2139cc427e9b42521952e2be9eaa6200faf7dc4d5000dfe705540/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f6c6f696c6f2f636f6e74616f2d657865632d62756e646c652f6d6173746572)](https://github.com/loilo/contao-exec-bundle/actions)[![Version on packagist.org](https://camo.githubusercontent.com/e11ea6ebf8dab0b4fbb3ca48f43e6d3d16a091dac2f7699d75cc66acc7f32f1c/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6c6f696c6f2f636f6e74616f2d657865632d62756e646c65)](https://packagist.org/packages/loilo/contao-exec-bundle)

This package allows to execute PHP code in the context of a Contao application, directly from the command line.

It provides two ways to do so:

- **A [PsySH](http://psysh.org)-based REPL** for tinkering around or getting some quick insight into the state of your Contao project.
- **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.

Installation
------------

[](#installation)

```
composer require loilo/contao-exec-bundle
```

Usage
-----

[](#usage)

### REPL

[](#repl)

You can open up the REPL with the `debug:repl` command:

```
vendor/bin/contao-console debug:repl
```

This will throw you into a nice REPL with the Contao framework loaded, all models, DCAs etc. available.

Also, [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:

```
// Get the URL to the newest page
db()->from('page')->asModel()->orderBy('id', 'desc')->first()->getAbsoluteUrl()
```

As usual, all options are available via

```
vendor/bin/contao-console help debug:repl
```

### Eval

[](#eval)

The `contao:eval` command takes some PHP code, passes it to the REPL and outputs the result.

If 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.

Therefore, it does not only have the default `dump` output formatting for human-readable data but also some others, including `json`:

```
# Get ID and title of the newest page as a JSON object
# This example requires the loilo/contao-illuminate-database-bundle to be installed
vendor/bin/contao-console contao:eval 'db()\
  ->from("page")\
  ->select("id", "title")\
  ->orderBy("id", "desc")\
  ->first()'\
  --format json\
  --no-ansi

# > {"id":1,"title":"Home"}
```

Again, use `vendor/bin/contao-console help contao:eval` to see what's possible with different options.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Total

4

Last Release

2233d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1da49bad9203cc40a34d975dc00c80af09452bee1da6413e2f1b8214b539675?d=identicon)[loilo](/maintainers/loilo)

---

Top Contributors

[![loilo](https://avatars.githubusercontent.com/u/1922624?v=4)](https://github.com/loilo "loilo (14 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/loilo-contao-exec-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/loilo-contao-exec-bundle/health.svg)](https://phpackages.com/packages/loilo-contao-exec-bundle)
```

###  Alternatives

[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k57.4M685](/packages/drush-drush)[drupal/console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.

93615.1M161](/packages/drupal-console)[pantheon-systems/terminus

A command line interface for Pantheon

3391.5M13](/packages/pantheon-systems-terminus)[n98/magerun

Tools for managing Magento projects and installations

1.4k264.7k7](/packages/n98-magerun)[n98/magerun2

Tools for managing Magento projects and installations

928244.3k6](/packages/n98-magerun2)[civicrm/cv

CLI tool for CiviCRM

4219.8k](/packages/civicrm-cv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
