PHPackages                             drarok/ladder1 - 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. drarok/ladder1

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

drarok/ladder1
==============

Database migration system written in PHP

v0.9.0(10y ago)71.3k5BSD-3-ClausePHPPHP &gt;=5.2.0

Since Aug 2Pushed 10y ago2 watchersCompare

[ Source](https://github.com/Drarok/ladder)[ Packagist](https://packagist.org/packages/drarok/ladder1)[ Docs](http://drarok.com/ladder)[ RSS](/packages/drarok-ladder1/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (9)Used By (0)

Ladder
======

[](#ladder)

What is it?
-----------

[](#what-is-it)

Ladder started life as a very simple database migration system. It's grown over time to the beast you see before you. It's written in PHP 5, and supports the popular MySQL database server.

What would I use this for?
--------------------------

[](#what-would-i-use-this-for)

Well, we use it in conjunction with source control (SVN, Git, Mercurial, et al) in order to track the changes we make to the database alongside our source code.

This allows us all to work on a project and know whether or not we have applied various changes to our local development environments.

Migrations have at least two methods: `up()` and `down()`. The `up()` method is run when the migration hasn't been applied and should have been. `down()` is run when the migration is being removed from the database. Logically, a `down()`method should do the opposite to its counterpart `up()` method. Dropping a column instead of adding it, etc.

Cool. How do I use it?
----------------------

[](#cool-how-do-i-use-it)

If you're reading this file, you've already got it (or you're reading it on Github/BitBucket…). Have a look in the config/ directory. Copy each file ending in ".sample", and remove the ".sample" part. Edit your copies of the files, plugging in your own settings such as database server.

Also, in the root of the project (the directory where this file is), take a copy of ladder.php.sample, rename it to ladder.php, change any settings in there (usually works out of the box, unless you're going for an advanced setup), and run the ladder.php script: `php ladder.php`.

If you don't see a list of valid commands, something has gone wrong. Sorry about that!

To create a migration use `php ladder.php create mymigration`. Now edit the created migration file at *migrations/00001\_mymigration.php* to specify the required actions for the migration.

Next use `php ladder.php migrate` to migrate the database.

Additionally, you can provide a migration number (or timestamp) to the migrate command in order to migrate to that specific point. The migrate command can be used to either migrate to a *newer* or *older* database scheme.

Does it do *x* or *y*?
----------------------

[](#does-it-do-x-or-y)

I'd advise you to check the documentation, but unfortunately, you're reading it. A brief list of supported features follows:

1. Table creation / alteration.
    Tables can be created - or altered if they already exist - seamlessly.
2. Column additions, alterations, removal.
    Columns can be added to tables, altered, moved, and removed. `Table->column()`, `Table->alter_column()`, and `Table->drop_column()`.
3. Index creation and removal.
    `Table->index()`, and `Table->drop_index()`.
4. CSV import/unimport.
    CSVs can be imported, either by inserting the data, or updating based on optional fields. They can also be un-imported when the migration is removed. See the properties:

    - Migration-&gt;import\_data
    - Migration-&gt;import\_update
    - Migration-&gt;import\_key\_fields
    - Migration-&gt;unimport\_data
    - Migration-&gt;unimport\_key\_fields
5. Key-value storage per migration.
    This is a new one. It allows you to - for example - store the id of a new record you create in migration *x*, then later refer to that id in migration *y*. A real-world example of this might be creating a new news article, then later having to remove that exact article, even if a user has changed its content. Look at `Migration->set()`, `Migration->get()`, and `Migration->remove()`.

Are there any examples?
-----------------------

[](#are-there-any-examples)

If you create a new migration (`php ladder.php create *migration_name*`), the template that is created contains a lot of the options you can use, but commented out.

Alternatively, take a look at  - I'm adding some examples there as requests come in.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.6% 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

Every ~158 days

Recently: every ~215 days

Total

7

Last Release

3767d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2fecfeadca598be917b367e724355b2ca1bef3611ca1bc4ad65435674a7e9d4?d=identicon)[Drarok](/maintainers/Drarok)

---

Top Contributors

[![Drarok](https://avatars.githubusercontent.com/u/55830?v=4)](https://github.com/Drarok "Drarok (33 commits)")[![veger](https://avatars.githubusercontent.com/u/171827?v=4)](https://github.com/veger "veger (8 commits)")[![vba-ds](https://avatars.githubusercontent.com/u/9948330?v=4)](https://github.com/vba-ds "vba-ds (1 commits)")

---

Tags

phpmigration

### Embed Badge

![Health badge](/badges/drarok-ladder1/health.svg)

```
[![Health](https://phpackages.com/badges/drarok-ladder1/health.svg)](https://phpackages.com/packages/drarok-ladder1)
```

###  Alternatives

[awssat/laravel-sync-migration

Laravel tool helps to sync migrations without refreshing the database

10823.4k](/packages/awssat-laravel-sync-migration)[chrishalbert/laravel-nomadic

A suite of tools to enhance robustness of laravel's migrations.

3127.6k](/packages/chrishalbert-laravel-nomadic)[robinncode/db_craft

DB Craft is a CodeIgniter4 Seeder, Migration Generator. Automatic Migration Generation: DB-Craft provides a simple command-line interface to generate migration files automatically based on the connected database. This feature allows developers to keep track of database schema changes and easily apply them to different environments. Table-Specific Migrations: Developers can also generate migration files for specific tables, providing granular control over database changes. This flexibility allows for efficient database management and versioning. Seeding Support: DB-Craft includes functionality to generate seeders, enabling developers to populate their database with initial data. This feature is especially useful for setting up sample data or populating reference tables.

194.5k](/packages/robinncode-db-craft)

PHPackages © 2026

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