Phinx is a PHP tool for managing database migrations without a full ORM. You define versioned schema changes in PHP or SQL and run them from the command line.
Overview
Phinx focuses on database migrations for PHP applications, deliberately avoiding the scope of a large ORM or application framework. You install it via Composer or as a Phar archive and drive it with a configuration file and migration classes.
Migrations can be written in database-agnostic PHP or raw SQL, then applied up or down to match environments. The tool supports seeding data after schema creation and fits into deployment or CI pipelines because it runs entirely from the shell.
Native adapters cover MySQL, PostgreSQL, SQLite, and Microsoft SQL Server. A typical workflow initializes a project config, creates migration files in a folder, and runs migrate against a named environment connection.
Documentation on phinx.org covers branch and PHP version compatibility, integration with any application, and using migrations alongside source control branching strategies.
Key features
- PHP or SQL migration files
- Migrate up and down
- Multiple database adapters
- Database seeding support
- Composer and Phar installation
- Environment-specific configuration
- Deployment-friendly CLI execution
- Framework-agnostic integration
Use cases
- Version database schema in PHP apps
- Run migrations during deploys
- Share schema changes across branches
- Seed reference data after migrations
- Avoid heavyweight ORM migration stacks