Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.61 KB

README.md

File metadata and controls

55 lines (39 loc) · 1.61 KB

Nextras ORM generator

Content

Installation

Most common way to install this tool is with composer:

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

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. 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();

You can also see example in our playground at 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 at https://github.com/contributte/nextras-orm-generator/tree/master/src/Config