Weave 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
Laravel Conditional Migrations

Laravel Conditional Migrations Laravel Package

mll-lab/laravel-conditional-migrations

Laravel Conditional Migrations adds condition-based execution to your database migrations, letting you run or skip specific migration files when predefined criteria are met. Ideal for environment-specific schema changes, feature rollouts, and safer deployments.

View on GitHub
Deep Wiki
Context7

Laravel Conditional Migrations lets you attach declarative conditions to your migrations, so schema changes only run where they actually make sense. Instead of scattering if (app()->environment(...)) checks throughout migration files, you define the requirement once and let the package decide whether each migration should execute.

  • Gate migrations by environment, config value, or a custom closure
  • Keep migration files readable by separating conditions from schema logic
  • Drop-in integration with php artisan migrate
  • Combine multiple conditions with a small, framework-native API
Frequently asked questions about Laravel Conditional Migrations
Is mll-lab/laravel-conditional-migrations still maintained?
No. The package is officially deprecated and will no longer receive updates. The maintainers point users to mll-lab/laravel-utils v4.0.0, which absorbs this functionality. New projects should adopt the replacement package instead, and existing projects should plan a migration rather than expecting further releases.
How do I install laravel-conditional-migrations with Composer?
Installation is a standard Composer require of mll-lab/laravel-conditional-migrations in a Laravel application. Because the package is deprecated, confirm the target Laravel version is inside its supported matrix before running the command. If a conflict constraint exists for an excluded Laravel patch, Composer resolution will fail rather than install into an untested combination.
Which Laravel versions does this package support?
The release notes show patch-level compatibility management, including marking Laravel 9.21 as unsupported. That means support is tracked per Laravel patch, not only by major or minor version. Check the package's composer.json require and conflict entries for the authoritative matrix before scoping an integration. Do not assume that a Laravel minor version supported in general makes every patch within it safe.
Why is Laravel 9.21 marked as unsupported?
The public release note only states that Laravel 9.21 is unsupported, without explaining whether the cause is a framework regression, a package incompatibility, or an untested edge case. Review the upstream issue tracker and any linked pull request to find the underlying reason. Until that is documented internally, future maintainers will not know why the patch is banned or when it might be re-supported.
How do I run a migration only when a condition is met?
The package lets you attach a condition to a migration so the schema change only executes when that condition evaluates to true. Typical conditions cover the current environment, a feature flag state, or the presence of specific data. This keeps environment checks out of individual migration files and centralizes them in one place. Consult the package source for the exact API surface, since the README excerpt here does not document method names.
What are good use cases for conditional migrations?
Common cases are environment-specific schema changes, feature-flagged columns or tables, and migrations that should only run when certain data exists. They are useful when the same codebase is deployed to staging, production, and customer-specific instances with different schema needs. They also help when a change must be rolled out gradually behind a flag rather than applied everywhere at once.
Should I use this package in production?
Adopting a deprecated package in production carries ongoing risk, since bug fixes and Laravel patch compatibility updates will stop. The safer path is mll-lab/laravel-utils v4.0.0, which replaces this package. If you must keep it temporarily, pin the package and Laravel in composer.lock and track it as technical debt with a removal date.
Does it enforce the unsupported Laravel version via composer.json conflicts?
That is not confirmed by the release note alone, and the difference matters operationally. If a conflict entry exists, Composer refuses installation and CI fails loudly on Laravel 9.21. If the exclusion is only documented, Composer will happily install into an untested combination and you may see silent behavioral drift. Inspect composer.json directly to determine which mechanism is in use.
How should I test conditional migrations in CI?
Pin the exact Laravel patch in each environment and assert it in CI, rather than testing only against the minor version. Run the migration suite against that specific patch, since patch-level exclusions imply framework internals are involved. Add a CI gate that fails when Laravel drifts into an unsupported patch, and keep both Laravel and the package pinned in composer.lock. Remember that each additional supported Laravel patch multiplies your test matrix.
What is the migration path away from laravel-conditional-migrations?
The maintainers recommend mll-lab/laravel-utils v4.0.0, which supersedes this package. Review the replacement's release notes and supported Laravel matrix, then swap the dependency and remove the old one from composer.json. Applications pinned to Laravel 9.21 may need to upgrade or pin Laravel back before either package installs cleanly.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo