PHPackages                             lulco/phoenix - 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. lulco/phoenix

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

lulco/phoenix
=============

Database Migrations for PHP

3.0.0(5mo ago)180329.4k—5.7%24[1 PRs](https://github.com/lulco/phoenix/pulls)4MITPHPPHP ^8.4CI passing

Since Jan 4Pushed 5mo ago5 watchersCompare

[ Source](https://github.com/lulco/phoenix)[ Packagist](https://packagist.org/packages/lulco/phoenix)[ RSS](/packages/lulco-phoenix/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (46)Used By (4)

Phoenix
=======

[](#phoenix)

Framework agnostic database migrations for PHP.

[![PHP unit](https://github.com/lulco/phoenix/workflows/PHPunit/badge.svg)](https://github.com/lulco/phoenix/actions?query=workflow%3APHPunit)[![PHPStan level](https://camo.githubusercontent.com/e377a0bbb2cf2029cec2a27ee7e143a6387e208e7b842b57552b104f645af640/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c3a253230382d627269676874677265656e2e737667)](https://github.com/lulco/phoenix/actions?query=workflow%3A%22PHP+static+analysis%22)[![PHP static analysis](https://github.com/lulco/phoenix/workflows/PHP%20static%20analysis/badge.svg)](https://github.com/lulco/phoenix/actions?query=workflow%3A%22PHP+static+analysis%22)[![SensioLabsInsight](https://camo.githubusercontent.com/9bf7771482a2020a3efc61f3e54ee4402e9e47bc4433f932de6b27d4774bf4c1/68747470733a2f2f696e73696768742e73796d666f6e792e636f6d2f70726f6a656374732f64643837323363342d383565612d346332382d623438392d3963633739333732363464302f6d696e692e706e67)](https://insight.symfony.com/projects/dd8723c4-85ea-4c28-b489-9cc7937264d0)[![Latest Stable Version](https://camo.githubusercontent.com/42cb63f0cbdb653bdf305007ca39aa4be1a6989d3d515c5ce6ed9514abc7bb8c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756c636f2f70686f656e69782e737667)](https://packagist.org/packages/lulco/phoenix)[![Total Downloads](https://camo.githubusercontent.com/f98f4fca8edd2be27574db73f0d86baddbd92f073666aeeb4b8960727be95164/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756c636f2f70686f656e69782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lulco/phoenix)[![PHP 7 supported](https://camo.githubusercontent.com/04a4726723a9839dcdd253b20b417148bf0bb20e2e4c086ba304659e7925c9d5/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f6c756c636f2f70686f656e69782f6d61737465722f62616467652e737667)](https://github.com/lulco/phoenix/actions)

Features
--------

[](#features)

- **Comprehensive Validation**: Validate all settings in your migrations before executing the first query, ensuring error-free operations.
- **Multiple Directories**: Manage multiple migration directories with ease, enhancing organizational capabilities.
- **View Support**: Full support for database views, extending the flexibility of your migrations.
- **Bidirectional Migrations**: Seamlessly migrate both up and down, allowing for smooth transitions and rollbacks.
- **Query Debugging**: Print executed queries in debug mode (`-vvv`), providing transparency and aiding in troubleshooting.
- **Dry Run Mode**: Execute migrations in a dry run mode to preview changes without making any actual modifications, ensuring safe deployments.
- **Auto-Increment Columns**: Effortlessly add an autoincrement primary column to an existing table, simplifying schema modifications.
- **Database Dump**: Use the dump command to create migrations from an existing database, facilitating easy migration setup.
- **Database Diffing**: Generate diff migrations between two existing databases, making it simple to synchronize changes.
- **Migration Testing**: Test new migrations with commands that execute, rollback, and re-execute migrations, ensuring reliability before deployment.
- **Migration Status**: View a detailed status report of executed and pending migrations, keeping track of your migration history.
- **JSON Output**: Get outputs in JSON format for all commands, enabling easy integration with other tools and workflows.
- **Namespace Support**: Use namespaces in migration classes for better organization and code management.
- **Custom Templates**: Create and use your own migration templates, tailoring the process to fit your specific needs.
- **Framework Agnostic**: Easily integrate with any PHP application, offering a seamless migration experience.
- **Enhanced PHPStorm Integration**: Enjoy PHPStorm suggestions, with enhanced support when using the deep-assoc-completion plugin.
- **Collation Management**: Change collation for all existing tables and columns, providing full control over character set settings.
- **Foreign Key Control**: Toggle foreign key checks on and off within migrations, offering flexibility during complex schema changes.
- **Simple Autowiring**: Benefit from simple autowiring in migrations, reducing boilerplate code and enhancing productivity.

### Supported adapters

[](#supported-adapters)

- MySQL
- PostgreSQL

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

[](#installation)

### Composer

[](#composer)

This library requires PHP 7.4 or later. It works also on PHP 8.0+. The fastest and recommended way to install Phoenix is to add it to your project using Composer ().

```
composer require lulco/phoenix

```

Usage
-----

[](#usage)

### [Create configuration file](docs/configuration/index.md)

[](#create-configuration-file)

Create file `phoenix.php` in the root directory of your project. For example:

```
