akempes / laravel-mutations
Manage commands/code that should only run once like migrations
Installs: 562
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
Type:package
pkg:composer/akempes/laravel-mutations
Requires
This package is auto-updated.
Last update: 2025-10-29 03:24:51 UTC
README
Manage commands/code that should only run once like migrations. Ideal to perform mutations to your existing database during CI/CD pipelines.
Installation
- Install the package
php composer require akempes/laravel-mutations - Add the package service provider to
providerssection in your./config/app.phpfile.'providers' => [ ... Akempes\Mutations\MutationsServiceProvider::class, ... ], - (Optional) Publish the config file if you need to change the default table name 'mutations'.
php artisan vendor:publish --provider="Akempes\Mutations\MutationsServiceProvider" - Create the mutations repository
php artisan mutate:install
How to use
Just like a migration, create a mutation:
php artisan make:mutation MyFirstMutation
The mutation files are created in the database/mutations/ directory. Each mutation has an up() and down() method just like a migration.
To run your mutations:
php artisan mutate
And rollback:
php artisan mutate:rollback