# Nextras ORM generator

# Content

# Installation

Most common way to install this tool is with composer:

composer require --dev contributte/nextras-orm-generator
1

This script does not require to be part of your project so you can install it anywhere you like and just provide path to desired dir where entities will be generated.

# Usage

  1. Generate all entities in same folder (together)
$config = [
    'output' => __DIR__ . '/model/together',
    //other options
    ];
$factory = new SimpleFactory(
	new TogetherConfig($config),
	new DatabaseAnalyser('mysql:host=127.0.0.1;dbname=nextras_orm_generator', 'root')
);

$factory->create()->generate();
1
2
3
4
5
6
7
8
9
10
  1. Generate entities separately
$config = [
    'output' => __DIR__ . '/model/together',
    //other options
    ];
$factory = new SimpleFactory(
	new SeparateConfig($config),
	new DatabaseAnalyser('mysql:host=127.0.0.1;dbname=nextras_orm_generator', 'root')
);

$factory->create()->generate();
1
2
3
4
5
6
7
8
9
10

You can also see example in our playground: https://github.com/contributte/playground/tree/master/nextras-orm-generator

# Configuration

This tool is highly configurable, take a look at configuration class for list of all available options: https://github.com/contributte/nextras-orm-generator/tree/master/src/Config