Download the PHP package kraicdesign/eloquent-bundle without Composer
On this page you can find all versions of the php package kraicdesign/eloquent-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kraicdesign/eloquent-bundle
More information about kraicdesign/eloquent-bundle
Files in kraicdesign/eloquent-bundle
Package eloquent-bundle
Short Description Symfony bundle that wires Laravel's Eloquent (Illuminate Database) into the Symfony container, with database:migrate and database:migrate:rollback console commands.
License MIT
Informations about the package eloquent-bundle
EloquentBundle
Wires Laravel's 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.
Requirements
- PHP 8.2+
- Symfony 6.4, 7.x, or 8.x
- Illuminate Database 11, 12, or 13
Installation
If you are not using Symfony Flex, register the bundle manually:
Configuration
Options
| Option | Default | Description |
|---|---|---|
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
Dependency injection
The bundle registers these services, all private, so you type-hint them normally:
| Type-hint | Resolves to |
|---|---|
Kraicdesign\EloquentBundle\Contract\DatabaseConnection |
the recommended, focused default-connection contract |
Kraicdesign\EloquentBundle\Contract\SchemaInspector |
the recommended schema-inspection contract |
Illuminate\Database\ConnectionInterface |
the default connection |
Illuminate\Database\Connection |
the default connection |
Illuminate\Database\Capsule\Manager |
the Capsule itself |
For application services, prefer DatabaseConnection. It exposes the commonly
used query and transaction operations together with getSchemaBuilder(), whose
SchemaInspector result provides hasTable() and hasColumn() without coupling
callers to Illuminate's large concrete connection and schema-builder classes.
It also exposes disconnect() to release the underlying PDO; later queries
transparently reconnect when needed.
The existing Illuminate connection type-hints remain available and resolve
exactly as before. The focused contracts are intentionally not wrappers around
the entire Illuminate query API: table() returns
Illuminate\Database\Query\Builder, and raw() returns
Illuminate\Database\Query\Expression by design.
Adding disconnect() in v1.2.0 is additive for consumers, but technically
breaking for external implementations of DatabaseConnection, which must add
the new method.
Eloquent models
Capsule::setAsGlobal() and bootEloquent() are called during container
compilation, so Eloquent models work without further setup:
Migrations
Migration files use the standard Illuminate format:
The migrations table is created automatically on first run.
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
Issues and pull requests are welcome. Please keep changes focused, and add a test for behaviour changes.
License
MIT — see LICENSE.
All versions of eloquent-bundle with dependencies
illuminate/database Version ^11.0 || ^12.0 || ^13.0
illuminate/filesystem Version ^11.0 || ^12.0 || ^13.0
symfony/config Version ^6.4 || ^7.0 || ^8.0
symfony/console Version ^6.4 || ^7.0 || ^8.0
symfony/dependency-injection Version ^6.4 || ^7.0 || ^8.0
symfony/http-kernel Version ^6.4 || ^7.0 || ^8.0