luongolabs / block-migrate
Run straight code blocks during laravel migrations.
Fund package maintenance!
Luongo Labs
Requires
- php: ^8.1
- illuminate/contracts: ^10.0|^11.0|^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^7.7|^8.0|^9.0|^10.0
- pestphp/pest: ^3.0|^3.1
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2025-06-16 22:19:29 UTC
README
Does what it says on the tin. Run code blocks during laravel migrations with the ability to roll them back, this is based on spatie/laravel-settings mainly the migration creation part.
Installation
You can install the package via composer:
composer require luongolabs/block-migrate
You can publish the config file with:
php artisan vendor:publish --tag="block-migrate-config"
This is the contents of the published config file:
return [ 'migrations_paths' => [ database_path('blocks'), ], ];
Usage
Let's say you need to rotate the auth tokens in the application due to a change in your new code, run php artisan make:block-migration RotateAuthTokens
to create the migration.
This would create the file database/blocks/2021_08_01_000000_rotate_auth_tokens.php
with the following contents:
<?php use LuongoLabs\BlockMigrate\Migrations\BlockMigration; return new class extends BlockMigration { public function up(): void { } public function down(): void { } };
You can then add your code to the up
and down
methods, then run php artisan migrate
to run the migration.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.