Contributte Nextras-orm-generator
# Content
- Installation (opens new window)
- Usage - how to run (opens new window)
- Configuration - how to configure (opens new window)
# 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
- 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
2
3
4
5
6
7
8
9
10
- Generate entities separately
$config = [
'output' => __DIR__ . '/model/separated',
//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
2
3
4
5
6
7
8
9
10
You can also see example in our playground at https://github.com/contributte/playground/tree/master/nextras-orm-generator (opens new window)
# Configuration
This tool is highly configurable, take a look at configuration class for list of all available options at https://github.com/contributte/nextras-orm-generator/tree/master/src/Config (opens new window)