PHPackages                             byjg/migration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. byjg/migration

ActiveLibrary[Database &amp; ORM](/categories/database)

byjg/migration
==============

A simple, framework-agnostic database migration tool that uses pure SQL commands for versioning your database.

6.0.0(5mo ago)16584.7k↓26%28[12 issues](https://github.com/byjg/php-migration/issues)9MITPHPPHP &gt;=8.3 &lt;8.6CI passing

Since Jun 9Pushed 2mo ago6 watchersCompare

[ Source](https://github.com/byjg/php-migration)[ Packagist](https://packagist.org/packages/byjg/migration)[ GitHub Sponsors](https://github.com/byjg)[ RSS](/packages/byjg-migration/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (32)Used By (9)

   sidebar\_key migration   tags    php

 databases

 cli

    Database Migration
==================

[](#database-migration)

A simple, framework-agnostic database migration tool that uses pure SQL commands for versioning your database.

[![Sponsor](https://camo.githubusercontent.com/fab14b7f7f475072ada0473f193d6f322561fd4a2958e0cc89910d053347cf27/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2532336561346161613f6c6f676f3d67697468756273706f6e736f7273266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d306431313137)](https://github.com/sponsors/byjg)[![Build Status](https://github.com/byjg/php-migration/actions/workflows/phpunit.yml/badge.svg?branch=master)](https://github.com/byjg/php-migration/actions/workflows/phpunit.yml)[![Opensource ByJG](https://camo.githubusercontent.com/425c1bbccc0f292bf4d20569ae74a6b2e384fd648f1af8911bc61de9a8dcfc0b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e736f757263652d62796a672d737563636573732e737667)](http://opensource.byjg.com)[![GitHub source](https://camo.githubusercontent.com/88e61eb211719144efdd570290a0456b6e13099c2df8d973f1bb43fe33bf0039/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769746875622d736f757263652d696e666f726d6174696f6e616c3f6c6f676f3d676974687562)](https://github.com/byjg/php-migration/)[![GitHub license](https://camo.githubusercontent.com/adf62b1b9a2ae60366f69c6e0cbab1f124415162d118e6d2ada4bd9191e6435c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f62796a672f7068702d6d6967726174696f6e2e737667)](https://opensource.byjg.com/opensource/licensing.html)[![GitHub release](https://camo.githubusercontent.com/4d00b96a8b38e324c6e5b0e305fb4e9a669aece7ce23f46d3bd4d2efd9927619/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f62796a672f7068702d6d6967726174696f6e2e737667)](https://github.com/byjg/php-migration/releases/)

Key Features
------------

[](#key-features)

- **Pure SQL Migrations** - Use native SQL commands instead of framework-specific code
- **Multiple Database Support** - Works with MySQL, PostgreSQL, SQLite, and SQL Server
- **Framework Independent** - Can be used with any PHP framework or standalone
- **CLI &amp; Library Support** - Use as a command-line tool or integrate into your PHP application
- **Transaction Support** - Ensures database consistency (where supported)
- **Multi-Developer Friendly** - Supports parallel development with -dev suffixed versions

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require "byjg/migration"
```

### CLI Usage

[](#cli-usage)

The package includes a built-in CLI tool:

```
# Show current database version
vendor/bin/migrate version --connection mysql://user:pass@localhost/database

# Update database to latest version
vendor/bin/migrate update --connection mysql://user:pass@localhost/database --path ./migrations

# Reset database and run all migrations
vendor/bin/migrate reset -c mysql://user:pass@localhost/database -p ./migrations
```

See [CLI Usage](docs/cli-usage.md) for complete documentation.

### Library Usage

[](#library-usage)

```
