diff --git a/.docs/README.md b/.docs/README.md deleted file mode 100644 index b4d7d41..0000000 --- a/.docs/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Nextras ORM generator - -## Content -- [Installation](https://github.com/contributte/nextras-orm-generator/blob/master/.docs/README.md#usage) -- [Usage - how to run](https://github.com/contributte/nextras-orm-generator/blob/master/.docs/README.md#usage) -- [Configuration - how to configure](https://github.com/contributte/nextras-orm-generator/blob/master/.docs/README.md#configuration) - -## Installation - -Most common way to install this tool is with composer: - -```bash -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) - -```php -$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(); -``` - -2. Generate entities separately - -```php -$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 diff --git a/README.md b/README.md index 224d968..7602799 100644 --- a/README.md +++ b/README.md @@ -18,30 +18,74 @@ Website 🚀 contributte.org | Contact 👨🏻‍💻 f3l1x.io | Twitter 🐦 @contributte

-## Usage +Generate Nextras ORM entities from an existing database schema with configurable output for together or separated model layouts. + +## Versions + +| State | Version | Branch | PHP | +|-------------|---------|----------|----------| +| dev | `^0.7` | `master` | `>= 8.1` | +| stable | `^0.6` | `master` | `>= 8.1` | + +## Installation To install the latest version of `contributte/nextras-orm-generator` use [Composer](https://getcomposer.org). ```bash -composer require contributte/nextras-orm-generator +composer require --dev contributte/nextras-orm-generator ``` -## Documentation +This script does not need to be part of your project, so you can install it anywhere you like and provide a path to the desired directory where entities will be generated. -For details on how to use this package, check out our [documentation](.docs). +## Usage -## Versions +### Generate All Entities Together -| State | Version | Branch | PHP | -|-------------|---------|----------|----------| -| dev | `^0.7` | `master` | `>= 8.1` | -| stable | `^0.6` | `master` | `>= 8.1` | +```php +$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(); +``` + +### Generate Entities Separately + +```php +$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 [contributte/playground](https://github.com/contributte/playground/tree/master/nextras-orm-generator). + +To try the bundled SQLite example locally, run: + +```bash +php examples/together.php +``` + +## Configuration + +This tool is highly configurable. Take a look at [configuration classes](src/Config) for list of all available options. ## Development See [how to contribute](https://contributte.org/contributing.html) to this package. -This package is currently maintaining by these authors. +This package is currently maintained by these authors.