Automated scheme creator & updater integrated and built for idiorm & paris. Currenlty works only with MySQL

0.1.3 2013-11-17 12:09 UTC


Autoparis is a library, that extends j4mie's paris ORM for automated scheme creation and keeping it up to date.

How to use it?


Autoparis can be simply installed by composer, actual install information you can found at page on packagist.


  1. Model should extend \Autoparis\AutoModel and provide public ( non static ) method getFields(). It should return array of instances of \Autoparis\Field or classes extending it.
  2. public static $_field of every model should be setted up.
  3. You should provide lookup_models() function in bin/autoparis.php, that'll return array of models classes
  4. And you should properly configure idiorm when you start autoparis (you can get trough it simply including your project boostrap, that will call ORM::configure's)


Autoparis is a cli-tool, located in bin/autoparis.php. You can get help trough --help. Autoparis has behavior like django's tool. By default, autoparis will update all schemes for models returned by lookup_models() Like django, autoparis will not modify your tables if you dont provide --force option, because that action can damage data, so dont run it on production databases.


There is documentation, that covers few topics that might be unclear and usefull.


// model class
class User extends \Autoparis\AutoModel {
    public static $_table = 'users';

    public function getFields() {
        return [
            new \Autoparis\Int("id", ["nn" => true]),
            new \Autoparis\Varchar("username", 32),
            new \Autoparis\Varchar("password"", 32),
            new \Autoparis\DateTime("joined", ["default" => "now"])

// in autoparis.php

function lookup_models() {
    return ["\User"];

$ ./autoparis.php
    Processing \User...
    Up to date.
mysql [db]> show columns from users;
    | Field    | Type        | Null | Key | Default | Extra |
    | id       | int(11)     | NO   |     | NULL    |       |
    | username | varchar(32) | YES  |     | NULL    |       |
    | password | varchar(32) | YES  |     | NULL    |       |
    | joined   | datetime    | YES  |     | NULL    |       |