PHPackages                             myaghobi/f3-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. myaghobi/f3-migrations

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

myaghobi/f3-migrations
======================

A database helper plugin for the Fat-Free framework.

v2.0.1(4y ago)158113GPL-3.0CSS

Since Oct 31Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/myaaghubi/f3-migrations)[ Packagist](https://packagist.org/packages/myaghobi/f3-migrations)[ Docs](https://github.com/myaghobi/f3-migrations)[ RSS](/packages/myaghobi-f3-migrations/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

F3-Migrations
=============

[](#f3-migrations)

F3-Migrations is a database helper plugin for the [Fat-Free Framework](http://github.com/bcosca/fatfree). It's something like version control for the sql databases. Every time you have to make some changes manually in your database, you can make a `MigrationCase`, and the plugin will handle that.

- [F3-Migrations](#f3-migrations)
    - [Installation](#installation)
    - [Operation and basic usage](#operation-and-basic-usage)
        - [Instantiate](#instantiate)
        - [First migration](#first-migration)
        - [Config](#config)
        - [Logging](#logging)
        - [CLI mode](#cli-mode)
    - [Upgrade](#upgrade)
    - [License](#license)

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

[](#installation)

If you use composer, run the below code:

```
composer require myaghobi/f3-migrations

```

For manual installation:

1. Copy the content of `lib/` folder into your `lib/` folder.
2. Install [Schema Builder](https://github.com/ikkez/f3-schema-builder) as mentioned in its documentation.
3. Install [Html2Text](https://github.com/mtibben/html2text), by placing the `html2text.php` inside of a folder named `html2text` in your `lib/`.

Operation and basic usage
-------------------------

[](#operation-and-basic-usage)

The plugin provides a simple web interface, consists of 4 routes that will auto add to your app:

- `GET /migrations` displays the web interface
- `GET /migrations/@action` triggers an action
- `GET /migrations/@action/@target` specific target version for the action
- `GET /migrations/theme/@type/@file` to retrive css/js files if you have stored the UI dir in non-web-accessible path (recommended)

Also, it will create a table in your database named `migrations` to handle migrations.

### Instantiate

[](#instantiate)

Instantiate the `Migrations` class before `f3->run()`. The plugin works if `DEBUG>=3`, otherwise, it goes disable because of security issues and to get no resource usage. To work with `Migrations` you need an active SQL connection:

```
// require('vendor/autoload.php');
// $f3=Base::instance();
$f3=require('lib/base.php');
...
// Acording to f3-schema-builder
// MySQL, SQLite, PostgreSQL & SQL Server are supported
$db = new \DB\SQL('mysql:host=localhost;port=3306;dbname='.$DBName, $user, $pass);
...
\DB\MIGRATIONS\Migrations::instance($db);
$f3->run();
```

### First migration

[](#first-migration)

1. Make sure the path of your cases directory be exists and secure.
2. Call `yourAppPublicUrl/migrations` in browser.
3. Use `makecase` action to make your first migration case.
4. Call `migrate` action.

### Config

[](#config)

This plugin is configurable via config file:

```
[migrations]
ENABLE=true
; PATH relative to `index.php`
PATH=../migrations
SHOW_BY_VERSOIN=true
CASE_PREFIX=migration_case_
LOG=true
```

The above config is the default, you can ignore/remove each one you don't need to change.

### Logging

[](#logging)

You can find the logs of actions in `migrations.log` located in the [LOGS](http://fatfreeframework.com/quick-reference#LOGS) folder.

### CLI mode

[](#cli-mode)

Just run the below code:

```
php index.php /migrations

```

Upgrade
-------

[](#upgrade)

1. First update the plugin via composer or manually.
2. Now the path of migration cases is relative to `index.php`, so make sure it be exists.
3. Make a backup of your DB and migration cases.
4. Call `upgrademc` action to update the old migration cases.

Finally call `fresh` action.

License
-------

[](#license)

You are allowed to use this plugin under the terms of the GNU General Public License version 3 or later.

Copyright (C) 2021 Mohammad Yaghobi

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance40

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~248 days

Total

2

Last Release

1771d ago

Major Versions

v1.2.0 → v2.0.12021-07-06

### Community

Maintainers

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

---

Top Contributors

[![myaaghubi](https://avatars.githubusercontent.com/u/4276074?v=4)](https://github.com/myaaghubi "myaaghubi (17 commits)")

---

Tags

databasedatabase-migrationsf3-migrationsfat-free-frameworkfat-free-pluginmigrationsqlmigrationdatabasesqlfat-free frameworkfat-free-pluginf3-migrations

### Embed Badge

![Health badge](/badges/myaghobi-f3-migrations/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)[foolz/sphinxql-query-builder

A PHP query builder for SphinxQL and ManticoreQL with MySQLi and PDO drivers.

3232.2M32](/packages/foolz-sphinxql-query-builder)[odan/phinx-migrations-generator

Migration generator for Phinx

235847.8k23](/packages/odan-phinx-migrations-generator)

PHPackages © 2026

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