PHPackages                             akrabat/zf1-db-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. akrabat/zf1-db-migrate

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

akrabat/zf1-db-migrate
======================

Akrabat's Zend Tool Provider for DB Migration

4422PHP

Since Aug 3Pushed 13y agoCompare

[ Source](https://github.com/MarcelloDuarte/zf1-db-migrate)[ Packagist](https://packagist.org/packages/akrabat/zf1-db-migrate)[ RSS](/packages/akrabat-zf1-db-migrate/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Akrabat ZF library
==================

[](#akrabat-zf-library)

See [Akrabat\_Db\_Schema\_Manager: Zend Framework database migrations](http://akrabat.com/zend-framework/akrabat_db_schema_manager-zend-framework-database-migrations/) for full details

ZF1:
----

[](#zf1)

To get the Zend\_Tool provider working:

1. Create a composer.json with the following

    ```
     {
         "require": {
             "akrabat/zf1-db-migrate": "dev-master",
             "breerly/zf1": "1.11.11"
         },
         "config": {
             "bin-dir": "bin/"
         }
     }

    ```
2. You need to have composer installed , and run

    ```
     php composer.phar install

    ```
3. Update your `~/.bash_profile` to set up an alias to the zf.php script

    ```
     alias zf='export ZF_CONFIG_FILE=/path/to/my/project/bin/.zf.ini; /path/to/my/project/bin/zf.php'

    ```

    Restart your terminal or `source ~/.bash_profile`
4. If you haven't already done so, setup the storage directory and config file:

    ```
     zf --setup storage-directory
     zf --setup config-file

    ```
5. Edit the created `.zf.ini`. Change path so that it includes ZF1 and Akrabat/zf1, allow for auotoloading Akrabat and set up the provider:

    ```
     php.include_path = "/path/to/zf1/library:/path/to/Akrabat/zf1/"
     autoloadernamespaces.0 = "Akrabat_"
     basicloader.classes.0 = "Akrabat_Tool_DatabaseSchemaProvider"

    ```
6. `zf` should provide a help screen with the `DatabaseSchema` provider at the bottom.

### Akrabat\_Db\_Schema\_Manager

[](#akrabat_db_schema_manager)

1. Create scripts/migrations folder in your ZF application
2. Create migration files within migrations with the file name format of nnn-Xxxx.php. e.g. 001-Users.php where:
    nnn =&gt; any number. The lower numbered files are executed first
    Xxx =&gt; any name. This is the class name within the file.
3. Create a class in your migrations file. Example for 001-Users.php:

    ```
     class Users extends Akrabat_Db_Schema_AbstractChange
     {
         function up()
         {
             $tableName = $this->_tablePrefix . 'users';
             $sql = "
                 CREATE TABLE IF NOT EXISTS $tableName (
                   id int(11) NOT NULL AUTO_INCREMENT,
                   username varchar(50) NOT NULL,
                   password varchar(75) NOT NULL,
                   roles varchar(200) NOT NULL DEFAULT 'user',
                   PRIMARY KEY (id)
                 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
             $this->_db->query($sql);

             $data = array();
             $data['username'] = 'admin';
             $data['password'] = sha1('password');
             $data['roles'] = 'user,admin';
             $this->_db->insert($tableName, $data);
         }

         function down()
         {
             $tableName = $this->_tablePrefix . 'users';
             $sql= "DROP TABLE IF EXISTS $tableName";
             $this->_db->query($sql);
         }

     }

    ```
4. If you want a table prefix, add this to your `application.ini`:

    ```
     resources.db.table_prefix = "prefix"

    ```

### Akrabat\\Db\\Schema\\Manager

[](#akrabatdbschemamanager)

1. Create scripts/migrations folder in your ZF application
2. Create migration files within migrations with the file name format of nnn-Xxxx.php. e.g. 001-Users.php where:
    nnn =&gt; any number. The lower numbered files are executed first
    Xxx =&gt; any name. This is the class name within the file.
3. Create a class in your migrations file. Example for 001-Users.php:

    ```
     class Users extends \Akrabat\Db\Schema\AbstractChange
     {
         function up()
         {
             $tableName = $this->_tablePrefix . 'users';
             $sql = "
                 CREATE TABLE IF NOT EXISTS $tableName (
                   id int(11) NOT NULL AUTO_INCREMENT,
                   username varchar(50) NOT NULL,
                   password varchar(75) NOT NULL,
                   roles varchar(200) NOT NULL DEFAULT 'user',
                   PRIMARY KEY (id)
                 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
             $this->_db->query($sql);

             $data = array();
             $data['username'] = 'admin';
             $data['password'] = sha1('password');
             $data['roles'] = 'user,admin';
             $this->_db->insert($tableName, $data);
         }

         function down()
         {
             $tableName = $this->_tablePrefix . 'users';
             $sql= "DROP TABLE IF EXISTS $tableName";
             $this->_db->query($sql);
         }

     }

    ```
4. If you want a table prefix, add this to your `application.ini`:

    ```
     resources.db.table_prefix = "prefix"

    ```

Phing Task
----------

[](#phing-task)

1. Define the phing task in the `build.xml`

    ```

    ```
2. Setup a phing target with the database options in the `build.xml`

    ```

    ```
3. Run phing using the command line, by `phing database-migration`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/126c34b4dff8d42336ea07ac5297bcc3ec0a0e306fd964a7497f02240da4b142?d=identicon)[md](/maintainers/md)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/akrabat-zf1-db-migrate/health.svg)

```
[![Health](https://phpackages.com/badges/akrabat-zf1-db-migrate/health.svg)](https://phpackages.com/packages/akrabat-zf1-db-migrate)
```

###  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)
