PHPackages                             kraicdesign/eloquent-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. kraicdesign/eloquent-bundle

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

kraicdesign/eloquent-bundle
===========================

Symfony bundle that wires Laravel's Eloquent (Illuminate Database) into the Symfony container, with database:migrate and database:migrate:rollback console commands.

v1.0.0(today)06↑2400%MITPHPPHP &gt;=8.2CI passing

Since Aug 1Pushed todayCompare

[ Source](https://github.com/kraicdesign/eloquent-bundle)[ Packagist](https://packagist.org/packages/kraicdesign/eloquent-bundle)[ RSS](/packages/kraicdesign-eloquent-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (7)Versions (2)Used By (0)

EloquentBundle
==============

[](#eloquentbundle)

Wires Laravel's [Eloquent](https://laravel.com/docs/eloquent) (Illuminate Database) into the Symfony container, and adds `database:migrate` and `database:migrate:rollback` console commands.

Useful when you want Eloquent's query builder, models, and migrations inside a Symfony application — migrating away from Laravel, or simply preferring Eloquent's ergonomics over Doctrine.

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Requirements
------------

[](#requirements)

- PHP 8.2+
- Symfony 6.4, 7.x, or 8.x
- Illuminate Database 11, 12, or 13

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

[](#installation)

```
composer require kraicdesign/eloquent-bundle
```

If you are not using Symfony Flex, register the bundle manually:

```
// config/bundles.php
return [
    // ...
    Kraicdesign\EloquentBundle\EloquentBundle::class => ['all' => true],
];
```

Configuration
-------------

[](#configuration)

```
# config/packages/eloquent.yaml
eloquent:
    default_connection: default

    connections:
        default:
            driver: pgsql
            host: '%env(DATABASE_HOST)%'
            port: '%env(int:DATABASE_PORT)%'
            database: '%env(DATABASE_NAME)%'
            username: '%env(DATABASE_USER)%'
            password: '%env(DATABASE_PASSWORD)%'
            charset: utf8
            prefix: ''
            schema: public

    migrations:
        path: '%kernel.project_dir%/database/migrations'
        table: migrations
        connection: default
```

### Options

[](#options)

OptionDefaultDescription`default_connection``default`Which entry in `connections` is the default.`connections`*required*Map of connection name to Illuminate connection config. Keys are passed through untouched, so any driver Illuminate supports works.`migrations.path``%kernel.project_dir%/database/migrations`Where migration files live.`migrations.table``migrations`Table recording applied migrations.`migrations.connection``default`Connection migrations run against. `default` resolves to `default_connection`.At least one connection is required.

Usage
-----

[](#usage)

### Dependency injection

[](#dependency-injection)

The bundle registers these services, all private, so you type-hint them normally:

Type-hintResolves to`Illuminate\Database\ConnectionInterface`the default connection`Illuminate\Database\Connection`the default connection`Illuminate\Database\Capsule\Manager`the Capsule itself```
use Illuminate\Database\ConnectionInterface;

final class UserRepository
{
    public function __construct(private readonly ConnectionInterface $db)
    {
    }

    public function findByEmail(string $email): ?object
    {
        return $this->db->table('users')->where('email', $email)->first();
    }
}
```

### Eloquent models

[](#eloquent-models)

`Capsule::setAsGlobal()` and `bootEloquent()` are called during container compilation, so Eloquent models work without further setup:

```
use Illuminate\Database\Eloquent\Model;

final class User extends Model
{
    protected $table = 'users';
}

User::query()->where('active', true)->get();
```

### Migrations

[](#migrations)

Migration files use the standard Illuminate format:

```
// database/migrations/2026_01_01_000000_create_users_table.php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

return new class extends Migration {
    public function up(): void
    {
        $this->schema()->create('users', function (Blueprint $table): void {
            $table->id();
            $table->string('email')->unique();
            $table->timestamps();
        });
    }

    public function down(): void
    {
        $this->schema()->dropIfExists('users');
    }
};
```

```
php bin/console database:migrate
php bin/console database:migrate:rollback
```

The migrations table is created automatically on first run.

Design notes
------------

[](#design-notes)

**Eloquent is registered globally.** `CapsuleFactory::create()` calls `setAsGlobal()` and `bootEloquent()`. This is what makes `Model::query()` work anywhere without injecting the Capsule, and it is the behaviour most people want from Eloquent. The trade-off is a process-wide static: the bundle supports several named connections, but only one Capsule, and that Capsule is global. If you need two isolated Capsules in one process, this bundle is not the right fit.

**No Doctrine interop.** This bundle does not integrate with Doctrine ORM, the Doctrine bundle's migrations, or `doctrine/dbal`. It is a standalone path.

**Connection config is passed through verbatim.** The `connections` node uses a variable prototype with `normalizeKeys(false)`, so Illuminate options are not validated or transformed by this bundle. Anything Illuminate accepts works; typos surface as Illuminate errors rather than Symfony config errors.

Contributing
------------

[](#contributing)

Issues and pull requests are welcome. Please keep changes focused, and add a test for behaviour changes.

```
composer install
vendor/bin/phpunit
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance100

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16218445?v=4)[kraicdesign](/maintainers/kraicdesign)[@kraicdesign](https://github.com/kraicdesign)

---

Tags

symfonybundledatabaseeloquentmigrationsilluminate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kraicdesign-eloquent-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/kraicdesign-eloquent-bundle/health.svg)](https://phpackages.com/packages/kraicdesign-eloquent-bundle)
```

PHPackages © 2026

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