Download the PHP package byjg/migration-cli without Composer
On this page you can find all versions of the php package byjg/migration-cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download byjg/migration-cli
More information about byjg/migration-cli
Files in byjg/migration-cli
Package migration-cli
Short Description Simple library in PHP for database version control. Supports Sqlite, MySql, Sql Server and Postgres.
License MIT
Informations about the package migration-cli
Database Migrations (CLI)
This is a simple library written in PHP for database version control. Currently supports SQLite, MySQL, SQL Server and PostgreSQL.
Database Migration can be used as:
- Command Line Interface
- PHP Library to be integrated in your functional tests
- Integrated in your CI/CD independent of your programming language or framework
Important Note
This package is the command line interface of ByJG PHP Migration.
Key Points:
- This CLI tool requires PHP to run, but your project doesn't need to be written in PHP
- You can use this tool with any programming language or framework
- Perfect for CI/CD pipelines and database versioning independent of your stack
For PHP API Integration: If you want to integrate migrations directly into your PHP code (e.g., for automated testing or programmatic control), use the core migration library instead:
- PHP API: byjg/migration - Full PHP library with programmatic API
- CLI Tool (this package): byjg/migration-cli - Command line interface only
For complete information about the migration system, architecture, and advanced usage, visit the core project documentation: https://github.com/byjg/migration
Installing
Documentation
- Getting Started - Installation, configuration, and environment variables
- Commands Reference - Detailed documentation for all available commands
- Migration Structure - How to organize and write migration files
- Examples - Practical examples and CI/CD integration
Quick Start
The basic usage is:
Connection String Examples:
- SQLite:
sqlite:///path/to/my.db - MySQL:
mysql://user:password@server/database - PostgreSQL:
pgsql://user:password@server/database - SQL Server:
dblib://user:password@server/database
Using Environment Variables:
Or use a .env file:
Available Commands
The migration tool provides the following commands:
| Command | Description |
|---|---|
create |
Create the directory structure for migrations |
install |
Install or upgrade the migration version table in an existing database |
version |
Get the current database version |
update |
Intelligently migrate up or down based on current version |
up |
Migrate up to a newer version |
down |
Migrate down to an older version |
reset |
Create a fresh database from base.sql and apply all migrations |
Command Options
All commands (except create) support these options:
--path, -p: Define the path where base.sql and migration scripts are located--up-to, -u: Specify a target version for migration--no-base: Skip checking for base.sql file-v, -vv, -vvv: Increase verbosity level
Quick Examples
Environment Variables
| Variable | Description | Default |
|---|---|---|
MIGRATE_CONNECTION |
Database connection string | - |
MIGRATE_PATH |
Path to migration files | Current directory |
MIGRATE_TABLE |
Name of the migration version table | migration_version |
MIGRATE_DISABLE_RESET |
Disable the reset command | false |
Related Projects
- Migration Core Library - PHP API for programmatic migration control (use this for PHP code integration)
- AnyDataset DB - Database abstraction layer
- Micro ORM - Lightweight ORM
- PHP Rest Template - REST client library
Dependencies
All versions of migration-cli with dependencies
byjg/migration Version ^5.0
symfony/console Version ^5.4|^6.0|^7.0
vlucas/phpdotenv Version ^5.6