PHPackages                             loilo/contao-illuminate-database-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. [Database &amp; ORM](/categories/database)
4. /
5. loilo/contao-illuminate-database-bundle

ActiveContao-bundle[Database &amp; ORM](/categories/database)

loilo/contao-illuminate-database-bundle
=======================================

Use Laravel's Illuminate Database abstraction in Contao

1.1.0(6y ago)074MITPHPPHP &gt;= 7.1

Since Jul 27Pushed 5y ago1 watchersCompare

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

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

Illuminate Database for Contao
==============================

[](#illuminate-database-for-contao)

[![Tests](https://camo.githubusercontent.com/3e6ead92a08b28368894048e90ed200dc07ba65b8053b9d0aa08196a3cb3cdd0/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f6c6f696c6f2f636f6e74616f2d696c6c756d696e6174652d64617461626173652d62756e646c652f6d6173746572)](https://github.com/loilo/contao-illuminate-database-bundle/actions)[![Version on packagist.org](https://camo.githubusercontent.com/82fe75ffceb0eab3aec296fa37e534b8de9fb17ed4011fc52488ecdccf819af8/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6c6f696c6f2f636f6e74616f2d696c6c756d696e6174652d64617461626173652d62756e646c65)](https://packagist.org/packages/loilo/contao-illuminate-database-bundle)

Use Laravel's [Illuminate Database](https://laravel.com/docs/queries) abstraction in Contao with support for Contao models.

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

[](#installation)

```
composer require loilo/contao-illuminate-database-bundle
```

Usage
-----

[](#usage)

### Getting Started

[](#getting-started)

Get the `db()` helper function:

```
use function Loilo\ContaoIlluminateDatabaseBundle\Database\db;
```

Calling the `db()` function creates a new [Laravel query builder](https://laravel.com/docs/queries) instance.

### Basic Queries

[](#basic-queries)

This is how we'd fetch ID and name of the earliest admin of the Contao installation:

```
$row = db()
  ->select('id', 'name')
  ->from('user')
  ->where('admin', '1')
  ->orderBy('dateAdded')
  ->first();
```

> Note how the `tl_` prefix is automatically prepended to table names, so we actually read from `tl_user`.

The above is just a very basic example. To get an idea of what's possible with this API, consult the [Laravel docs](https://laravel.com/docs/queries).

### Fetching Models

[](#fetching-models)

In addition to Laravel's built-in methods, the query builder of this package exposes an additional `asModel()` method.

Using it inside a query builder chain will instruct the `get()`, `first()`, `find()` and `cursor()` methods to return Contao models instead of plain database records.

To explain this based on the example above:

```
$user = db()
  ->from('user')
  ->asModel() // where('admin', '1')
  ->orderBy('dateAdded')
  ->first();

// $user will be an instance of \UserModel
```

### Customizing Connections

[](#customizing-connections)

The `db()` function takes an optional argument which may override keys from the default connection configuration [passed to Laravel's connection manager](https://laravel.com/api/5.8/Illuminate/Database/Capsule/Manager.html#method_addConnection):

```
// Set an empty prefix to use the "tl_user" table
db([ 'prefix' => '' ])->from('tl_user')->first();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

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 ~7 days

Total

4

Last Release

2506d 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 (13 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.0M88](/packages/mongodb-laravel-mongodb)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8723.1M23](/packages/yajra-laravel-oci8)[staudenmeir/laravel-adjacency-list

Recursive Laravel Eloquent relationships with CTEs

1.6k5.2M33](/packages/staudenmeir-laravel-adjacency-list)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.2M19](/packages/bavix-laravel-wallet)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.4M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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