PHPackages                             eril/schemage - 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. eril/schemage

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

eril/schemage
=============

Schema-first database migration engine for PHP.

v1.0.0(1mo ago)12MITPHPPHP ^8.2CI passing

Since May 24Pushed 2w agoCompare

[ Source](https://github.com/erilshackle/php-schemage)[ Packagist](https://packagist.org/packages/eril/schemage)[ Docs](https://erilshackle.github.io/php-schemage/)[ RSS](/packages/eril-schemage/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Schemage
========

[](#schemage)

Schema-first database migrations for PHP.

Schemage lets you describe the desired database structure with a clean PHP DSL, compare it with the current database, review a migration plan, generate SQL, and apply the required changes through a lightweight CLI.

[![PHP](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)[![Tests](https://github.com/erilshackle/php-schema-engine/actions/workflows/tests.yml/badge.svg)](https://github.com/erilshackle/php-schema-engine/actions/workflows/tests.yml/badge.svg)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)

Features
--------

[](#features)

- Schema-first PHP DSL
- MySQL, MariaDB, and SQLite support
- Database introspection and schema diffing
- Table, column, index, and foreign-key operations
- Explicit table and column renames
- Driver-specific operation planning
- Interactive migration plans
- Dry-run and SQL export modes
- Migration history and rollback support
- Destructive-operation protection
- Optional model generation

Installation
------------

[](#installation)

```
composer require eril/schemage
```

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

[](#quick-start)

```
