Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Doctrine Dbal Schema

Doctrine Dbal Schema Laravel Package

ezsystems/doctrine-dbal-schema

Doctrine DBAL schema utility package for eZ Platform/eZ Systems projects. Provides tools to define, compare and update database schemas using Doctrine DBAL, helping manage schema changes and migrations consistently across environments.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Doctrine Dbal Schema
Can I use ezsystems/doctrine-dbal-schema with Laravel’s built-in migrations?
Yes, but they serve different purposes. Laravel migrations are imperative and version-controlled, while this package provides declarative schema definitions (YAML/XML) for validation and runtime checks. Use migrations for changes and this package for schema governance, ensuring they stay in sync via CI/CD validation.
How do I define schemas in this package? Does it support Laravel’s Schema builder?
Schemas are defined declaratively in YAML/XML/PHP files, not Laravel’s Schema builder. The package provides APIs like `SchemaImporter` and `SchemaExporter` to work with Doctrine DBAL’s `Schema` objects. You’ll need to manually integrate it with Laravel’s lifecycle, likely via custom service providers or event listeners.
Will this package work with Laravel’s Eloquent ORM?
Yes, but schema changes must align with both Eloquent’s expectations and the package’s declarative definitions. Conflicts can arise if migrations and YAML/XML schemas diverge. Use this package for validation rather than as a replacement for migrations to avoid inconsistencies.
Does ezsystems/doctrine-dbal-schema support multi-database environments in Laravel?
Yes, it’s designed for cross-DBMS schema management, making it ideal for Laravel apps using multiple databases (e.g., MySQL, PostgreSQL, SQLite). It ensures schema parity across environments by validating and syncing schemas at runtime, which is harder to achieve with Laravel’s migration system alone.
How do I integrate this package into a Laravel project?
Install via Composer (`ezsystems/doctrine-dbal-schema`), then configure it to work with Laravel’s Doctrine DBAL instance. You’ll need to create a custom `EventSubscriber` to hook into the `SchemaBuilderEvents` and define how schemas are loaded. Example: Subscribe to `SchemaBuilderEvents::BUILD_SCHEMA` to import YAML files during app bootstrapping.
Is there a performance impact from using declarative schemas in Laravel?
Runtime schema validation adds overhead, but it can be optimized. Run validation only in non-production environments or during specific hooks (e.g., `booted` event). Profile your app to ensure it doesn’t slow down critical paths. For production, consider running validation as a one-time check during deployments.
Can I use this package to validate database state before Laravel migrations run?
Yes, this is a common use case. Integrate schema validation into your CI/CD pipeline or pre-migration hooks to ensure the database matches your expected schema. If validation fails, block migrations from executing, preventing schema drift.
What Laravel versions does ezsystems/doctrine-dbal-schema support?
The package itself doesn’t enforce Laravel version constraints, but it requires Doctrine DBAL (which Laravel uses). Test compatibility with your Laravel version (e.g., 8.x, 9.x, 10.x) by checking Doctrine DBAL support. Laravel 8+ is recommended due to its stable Doctrine integration.
Are there alternatives to this package for schema management in Laravel?
For declarative schemas, alternatives include custom Doctrine DBAL extensions or packages like `doctrine/dbal-tools`. For migration-focused workflows, Laravel’s built-in migrations or `laravel-migrations-generator` suffice. This package is unique in offering cross-DBMS schema diffing and validation, ideal for complex or legacy systems.
How do I handle schema conflicts between Laravel migrations and YAML/XML definitions?
Treat YAML/XML as the *source of truth* for validation, but keep migrations authoritative for changes. Use a hybrid workflow: Generate migrations from schema changes when possible, or manually sync them. Implement CI/CD checks to fail fast if conflicts arise, forcing resolution before deployment.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views