PHPackages                             piko/migrate - 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. piko/migrate

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

piko/migrate
============

A lightweight database migration tool.

v1.1(yesterday)04↓33.3%1MIT

Since Jul 7Compare

[ Source](https://github.com/piko-framework/migrate)[ Packagist](https://packagist.org/packages/piko/migrate)[ RSS](/packages/piko-migrate/feed)WikiDiscussions Synced today

READMEChangelogDependencies (6)Versions (3)Used By (1)

Piko Migrate
============

[](#piko-migrate)

A small command-line tool for database migrations, built on top of [`dakujem/migrun`](https://github.com/dakujem/migrun).

`piko/migrate` provides a simple wrapper around Migrun to run, rollback, and inspect migrations from your terminal.

Features
--------

[](#features)

- Lightweight CLI for migrations
- Built on reliable migration orchestration from `dakujem/migrun`
- Supports:
    - applying pending migrations
    - rolling back applied migrations
    - displaying migration status
- Configurable migrations directory

Requirements
------------

[](#requirements)

- PHP 8+
- A PDO-compatible database (MySQL, SQLite, PostgreSQL, etc.)
- Composer

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

[](#installation)

### As a dependency

[](#as-a-dependency)

```
composer require piko/migrate
```

Then use the generated binary:

```
./vendor/bin/migrate --help
```

### For local development

[](#for-local-development)

```
composer install
php ./bin/migrate --help
```

Configuration
-------------

[](#configuration)

The CLI reads database settings from environment variables:

- `DSN`
- `DB_USERNAME` (optional depending on DSN)
- `DB_PASSWORD` (optional depending on DSN)

You can also create an `env.php` file in your working directory. If present, it will be loaded automatically.

Example `env.php`:

```
