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

Phpmig Laravel Package

davedevelopment/phpmig

Phpmig is a lightweight, framework-agnostic PHP 5.3+ database migration tool. Run, generate, and track migrations from the CLI using a simple bootstrap container (e.g., Pimple) to wire your DB and services—Doctrine optional.

View on GitHub
Deep Wiki
Context7

Simple migrations system for php

Frequently asked questions about Phpmig
Can I use Phpmig with Laravel 10+ without conflicts?
Phpmig isn’t Laravel-native, so it won’t integrate directly with Artisan or Laravel’s migration table. You’d need to manually sync it with Laravel’s migrations or use it for non-critical migrations. Test thoroughly—last updates were in 2020, so PHP 8.1+ compatibility isn’t guaranteed.
How do I generate a migration file in Phpmig?
Run `phpmig generate [MigrationName]` from your project root. It creates a timestamped file (e.g., `20231001120000_AddUserTable.php`) in your `migrations/` directory. The class name must match the filename in CamelCase, and you define `up()`/`down()` methods for schema changes.
Does Phpmig support data migrations (inserts/updates) like Laravel’s?
Yes, Phpmig handles data migrations via the `up()` method (e.g., `DB::table('users')->insert(...)`). Unlike Laravel, it lacks built-in testing hooks or rollback data validation, so you’ll need to implement those manually or via custom scripts.
Will Phpmig work with my existing Laravel migration table?
No—Phpmig uses its own `phpmig_migrations` table by default. If you mix it with Laravel’s migrations, conflicts may arise. For hybrid setups, consider isolating Phpmig to legacy migrations or forking it to share a table with Laravel.
How do I integrate Phpmig into Laravel’s Artisan commands?
Create a custom Artisan command (e.g., `php artisan phpmig:migrate`) that calls Phpmig’s CLI via `shell_exec()` or wrap it in a service provider. Example: `exec('php bin/phpmig migrate');`. For tighter integration, extend Laravel’s `Migrator` to delegate to Phpmig’s runner.
Is Phpmig compatible with PHP 8.1+ and modern Laravel?
Officially, Phpmig supports PHP 5.3+, but it’s untested on PHP 8.1+. Features like named arguments or union types may break. For Laravel 10+, use it cautiously—prefer Laravel’s native migrations unless you need Phpmig’s specific features (e.g., Doctrine integration).
Can I use Phpmig for rollbacks in a Laravel project?
Yes, but manually. Phpmig’s `down()` method handles rollbacks, but you’ll need to trigger it via a custom Artisan command or CLI call. Unlike Laravel, it lacks transaction management or event listeners, so test rollbacks thoroughly in staging.
What’s the best way to test Phpmig migrations in Laravel?
Phpmig has no built-in testing tools, so use Laravel’s `Schema::fake()` for unit tests or write custom scripts with `DB::transaction()`. For integration tests, reset the `phpmig_migrations` table between runs or use Docker to spin up fresh databases.
Are there alternatives to Phpmig for Laravel with better maintenance?
For Laravel, use the built-in `migrate` command or packages like `laravel-migrations-generator` for schema changes. For framework-agnostic tools, consider Doctrine Migrations (active) or FlySystem-based solutions like `spatie/laravel-migration-snapshots`. Phpmig is only viable if you need its lightweight, non-Doctrine approach.
How do I configure Phpmig’s database connection in Laravel?
Edit your `phpmig.php` bootstrap file to return a Pimple container with a `db` key pointing to a PDO instance. Example: `$container['db'] = new PDO('mysql:host=...', 'user', 'pass');`. For Laravel, reuse your `.env` DB config by injecting Laravel’s `DB` facade into the container.
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle