devture/dbal
devture/dbal is a lightweight PHP database abstraction layer built on top of Doctrine DBAL, offering Laravel-friendly helpers for connections, query execution, and transaction handling. Ideal when you want DBAL features without pulling in a full ORM.
devture/dbal) provides a lightweight abstraction layer for MongoDB (Doctrine MongoDB ODM) and relational databases (Doctrine DBAL), enabling unified query execution, schema inspection, and transaction management. This is valuable for:
Connection, SchemaManager, and QueryBuilder patterns. Laravel’s Eloquent may need adapters for full integration.DB facade extensions). A custom service provider would be needed to integrate with Laravel’s IoC container.Model::created) wouldn’t natively integrate with this package’s eventing (if any).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Breaking Changes | Medium | Test against Doctrine DBAL 3.x and MongoDB ODM 2.x for stability. |
| Performance Overhead | Low | Benchmark against native Doctrine/Laravel drivers. Abstraction adds minimal overhead for simple queries. |
| Lack of Laravel Integration | High | Build custom facades/adapters (e.g., DB::mongo()). Contribute to the package for Laravel support. |
| Schema Migration Gaps | Medium | Use Laravel Migrations for SQL + custom scripts for MongoDB. |
| Community Support | High | Package has 0 stars; rely on Doctrine’s ecosystem for troubleshooting. |
DB facade, or build custom abstractions?jenssegers/mongodb)?DB::table() and MongoDB::collection() calls with a unified DBAL interface.devture/dbal wrappers.DB::mongo()) for ergonomics.config/database.php to define dual connections:
'connections' => [
'mysql' => [...],
'mongodb' => [
'driver' => 'mongodb',
'dsn' => env('MONGODB_DSN'),
'options' => [],
],
],
DBAL service provider to bind the package to Laravel’s container.doctrine/dbal package must be pinned to a compatible version.jenssegers/mongodb (if used) doesn’t conflict."require": {
"doctrine/dbal": "^3.6",
"doctrine/mongodb-odm": "^2.0",
"devture/dbal": "^1.0"
}
devture/dbal to work with Laravel’s connection resolvers.// config/dbal.php
'connections' => [
'default' => env('DB_CONNECTION'),
'mongodb' => 'mongodb',
],
// Before (Laravel + MongoDB)
$users = DB::table('users')->get();
$logs = MongoDB::collection('logs')->find();
// After (devture/dbal)
$users = DBAL::connection('mysql')->fetchAll('SELECT * FROM users');
$logs = DBAL::connection('mongodb')->executeQuery('db.logs.find()')->toArray();
Model::query()->toDbalQuery()).SchemaManager for both SQL and MongoDB.Connection, QueryBuilder, and SchemaManager APIs.? vs. named placeholders).How can I help you explore Laravel packages today?