PHPackages                             gersonalves/migration - 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. gersonalves/migration

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

gersonalves/migration
=====================

Package para criar migrations em seu BD

1.0.5(4y ago)211MITPHP

Since Sep 17Pushed 4y ago1 watchersCompare

[ Source](https://github.com/GersonACensus/Migration)[ Packagist](https://packagist.org/packages/gersonalves/migration)[ RSS](/packages/gersonalves-migration/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)DependenciesVersions (7)Used By (0)

Settings
========

[](#settings)

To configure it you must add it to your composer.

`composer require gersonalves/migration`

The project has the example files for easy understanding.

Implementation
==============

[](#implementation)

```
use migration\migration;
$myConnection = new PDO("mysql:host=localhost:3307;dbname=docker", 'docker', 'docker', [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
```

first, import the necessary files and start your PDO connection.

then select the appropriate place in your code to call to run a migration. and Add:

```
$migration = migration::run($myConnection, [
    'table' => 'migracoes',
    'migrations_dir' => 'migrations',
    'onlyJSON' => true,
    'continueWithErrors' => true,
    'mailTo' => 'gersonalvesdev@gmail.com'
]);
$migration->getResponse();
```

The second parameter is the configuration, here are some important information.

- table - This is the field to define the migration log table. Default 'migrations'
- migrations\_dir - This is the directory to save yours .sql files to migrate. Default is null.
- onlyJSON - if is true, the response have a JSON header. If false the response is an Array. Default false.
- continueWithErrors - If is true, when an error occurs, the other migrations will be persisted and it will return a list with successes and failures. if false, on error the interrupt the migration script and return a throw exception. Default false.

Response example
================

[](#response-example)

On JSON Success

```
  {
    "status": "success",
    "message": "Migração realizado com sucesso",
    "bag": [
      "YOUR SQL HERE"
    ]
  }
```

Informations
============

[](#informations)

The following features have execution blocking: `DROP, TRUNCATE, DELETE, UPDATE without WHERE.`

- In the next update, it will inform you which ones you want to allow.
- For all errors, the "status" is "error" regardless of using JSON or not.
- Only `.sql` files will be executed.

Public methods
==============

[](#public-methods)

- static RUN() - This is the framework's main method, responsible for making the necessary validations and executing a migration.
- getJSON() - This method will return the last response generated by the system, whether error or success. It is possible to be called only after the RUN method that will generate some response in JSON format.
- getArray() - is similar to getJSON but is an array response.
- getResponse() - It's the same as all the other two methods. But it will return according to the onlyJSON setting.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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 ~1 days

Total

6

Last Release

1697d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/52175d14ad3c131ef498a2286bf355b1ecab0fa37e8b5a02807a3d33de653ac6?d=identicon)[gersonalves](/maintainers/gersonalves)

---

Top Contributors

[![GersonACensus](https://avatars.githubusercontent.com/u/89476361?v=4)](https://github.com/GersonACensus "GersonACensus (20 commits)")

### Embed Badge

![Health badge](/badges/gersonalves-migration/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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