2017 © Pedro Peláez
 

library paris-model-generator

Paris model generator from database

image

davidepastore/paris-model-generator

Paris model generator from database

  • Friday, February 13, 2015
  • by DavidePastore
  • Repository
  • 1 Watchers
  • 1 Stars
  • 41 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

paris-model-generator

Paris model generator from database., (*1)

Installation

Using command line

$ composer require davidepastore/paris-model-generator:0.1.*

Editing composer.json

Require this generator:, (*2)

"require": {
  "davidepastore/paris-model-generator": "0.1.*"
}

Setup

You have to setup your application to be sure that the generated classes will be in the right place and with the right namespace. paris-model-generator uses composer.json extra property to put its configuration:, (*3)

"extra": {
  "paris-model-generator": {
    "namespace": "VendorName\\MyProject\\Models",
    "destination-folder": "src\\"
    }
}

namespace

It is the namespace in which all classes will be generated. It will be also used to create the folder structure to be PSR-4 compliant., (*4)

destination-folder

It is the folder in which all files (and folder structure) will be generated., (*5)

Usage

Be sure to be in the base directory of the project (where you have your composer.json file) and run:, (*6)

$ vendor/bin/paris-generator models [--force]

The generator will ask you information about the database, to be sure to connect to it and to retrieve the list of tables. The list of the supported drivers could be found here., (*7)

force option

The --force option will not ask you confirmation to overwrite existing files., (*8)

Include generated files

You have two chances: * psr-4 autoload; * classmap autoload., (*9)

PSR-4 autoload

If your namespace property is set you can use psr-4 composer autoload:, (*10)

"autoload" : {
  "psr-4" : {
    "" : "your-destination-folder/"
  }
}

Don't forget to set Model::$auto_prefix_models to be sure that your model is recognized properly when you use Model::factory method:, (*11)

Model::$auto_prefix_models = 'YourAmazing\\Namespace\\';

Classmap autoload

If your namespace property is empty or not set, you have to autoload using:, (*12)

"autoload": {
  "classmap" : [
    "your-destination-folder/"
  ]
}

Issues

If you have issues, just open one here., (*13)

The Versions

13/02 2015

dev-master

9999999-dev

Paris model generator from database

  Sources   Download

MIT

The Requires

 

by Davide Pastore

generator model paris

13/02 2015

v0.1.0

0.1.0.0

Paris model generator from database

  Sources   Download

MIT

The Requires

 

by Davide Pastore

generator model paris