thecodingmachine/dbal-fluid-schema-builder
A fluent, object-oriented PHP API for building Doctrine DBAL database schemas. Define tables, columns, indexes, and foreign keys with readable chained methods, making schema creation and migrations cleaner, more expressive, and less error-prone in any PHP project.
ALTER statements via Doctrine DBAL, instead of hand-rolling SQL generators.Schema builder, or teams that need a migration ledger, rollback, and audit trail as a product requirement (compliance, enterprise sales).Adopt when all of the following hold:
doctrine/dbal dependency). This is an additive layer over DBAL, not a standalone abstraction — without DBAL it is dead weight.Look elsewhere when:
Schema builder and migrations already cover column changes, and the ecosystem expects a migration ledger, migrate:rollback, and deploy-time execution. Introducing a second schema authority alongside migrations is a durable source of confusion and drift.To executives: This is a small, low-cost library that lets our code define database structure declaratively, which is the enabling capability behind tenant customization and our module/plugin roadmap. It saves us from writing and maintaining our own SQL-diff engine — realistically weeks of engineering plus ongoing bug surface. The trade-off is dependency concentration: it's maintained by a single agency with a modest community, so we should treat it as code we may need to fork. Recommendation: adopt behind an internal abstraction layer, with a hard cap on blast radius.
To engineering: It's a thin fluent DSL over Doctrine DBAL's schema manager. You describe the target table state; it computes and applies the diff. Adopt it only if we're already on DBAL, pin the DBAL version, and run every diff against a real database in CI. Two non-negotiables before it touches production: a plan/dry-run mode that prints the DDL without executing it, and a guardrail that blocks or requires approval for destructive operations (drop column, type narrowing, drop index). It is not a migrations replacement — no versions table, no rollback — so we keep Laravel migrations as the authority for core schema and confine this to runtime-provisioned structures (tenant tables, plugin tables). Wrap it behind our own SchemaProvisioner interface so swapping or forking stays a contained change.
How can I help you explore Laravel packages today?