PHPackages                             torandi/php-migrations - 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. torandi/php-migrations

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

torandi/php-migrations
======================

v1.0(10y ago)31953PHP

Since Feb 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/torandi/php_migrations)[ Packagist](https://packagist.org/packages/torandi/php-migrations)[ RSS](/packages/torandi-php-migrations/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Introduction
============

[](#introduction)

This is a php-script that helps you handling versions of your database in a format that works well with code versioning.

Configuration and setup
=======================

[](#configuration-and-setup)

1. composer require torandi/php-migrations
2. Create a directory in your project named "migrations" (or whatever)
3. Symlink update\_database.php and create\_migration.php into the directory.
4. Copy config-example.php to config.php and edit it to fit your project (see config-example.php for more info)

Usage
=====

[](#usage)

Use ./create\_migration.php migration\_name to create a new migration

This creates a empty migration with a name like 20110821231945\_migration\_name.sql. The file name (including the date) is the version name, and must be unique.

You may also specify a second argument to create\_migration to select file format (sql or php):

- SQL: SQL to be run for the migration (multiple lines separated by ;)
- PHP: PHP code to be executed, the environment you loaded in config.php is available, remember &lt;?php and be verbose. Not run in global scope

To then run the migrations execute ./update\_database.php which runs all unrun migrations. The table schema\_migrations are created (if not exist) containing all run migrations.

PHP-migration-script-helper-functions
-------------------------------------

[](#php-migration-script-helper-functions)

migration\_sql(query): Print and run query run\_sql(query): Run query in silence

update\_database.php usage
--------------------------

[](#update_databasephp-usage)

./update\_database.php \[options\] \[username\]

Username may be optional, depending on your config.php

### Arguments

[](#arguments)

```
--help,  -h: Show help
--check, -c: Checks if there are any migrations to run, but does not run them (dry run)

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 52% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3780d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/220e9a83ec9c97099085a93e849ffd506be80d6304f94eb8342405a23388d1cd?d=identicon)[Torandi](/maintainers/Torandi)

---

Top Contributors

[![torandi](https://avatars.githubusercontent.com/u/145322?v=4)](https://github.com/torandi "torandi (26 commits)")[![ext](https://avatars.githubusercontent.com/u/41535?v=4)](https://github.com/ext "ext (15 commits)")[![p-blomberg](https://avatars.githubusercontent.com/u/332457?v=4)](https://github.com/p-blomberg "p-blomberg (9 commits)")

### Embed Badge

![Health badge](/badges/torandi-php-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/torandi-php-migrations/health.svg)](https://phpackages.com/packages/torandi-php-migrations)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[yemenopensource/filament-excel

This package useful for importing excel files into models.

194.2k](/packages/yemenopensource-filament-excel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
