PHPackages                             unquam/nette-maker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. unquam/nette-maker

ActiveComposer-plugin[Database &amp; ORM](/categories/database)

unquam/nette-maker
==================

CLI code generator for Nette Framework: scaffold modules, migrations, seeders, factories, authentication, API resources, form requests and more.

v2.3.4(2w ago)172MITPHPPHP &gt;=7.4CI passing

Since May 18Pushed 2w agoCompare

[ Source](https://github.com/Unquam/nette-maker)[ Packagist](https://packagist.org/packages/unquam/nette-maker)[ RSS](/packages/unquam-nette-maker/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (7)Versions (24)Used By (0)

unquam/nette-maker
==================

[](#unquamnette-maker)

[![PHP Version](https://camo.githubusercontent.com/7404ac2849f95f99ace60c4b949c4e57e3188dfc0d5df7a913378138ac571fb6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344372e342d626c7565)](https://php.net)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)[![Tests](https://github.com/unquam/nette-maker/actions/workflows/tests.yml/badge.svg)](https://github.com/unquam/nette-maker/actions/workflows/tests.yml)[![Packagist Version](https://camo.githubusercontent.com/3dc81ab4fb0f1d7efaf875fcd2e52f1eeded73d6e65a57914673c403ffb58412/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f756e7175616d2f6e657474652d6d616b6572)](https://packagist.org/packages/unquam/nette-maker)[![Packagist Downloads](https://camo.githubusercontent.com/7f4f5efa8bf1ca5b5262d30d9afd3c58c68ba37ab139b29a6e4a949082ac70af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e7175616d2f6e657474652d6d616b6572)](https://packagist.org/packages/unquam/nette-maker)

A CLI code generator for [Nette Framework](https://nette.org). Scaffold presenters, models, repositories, services, Latte templates, and database migrations with a single command — without touching boilerplate ever again.

---

Requirements
------------

[](#requirements)

DependencyVersionPHP`>= 7.4`symfony/console`^5.0 || ^6.0 || ^7.0`nette/php-generator`^3.5 || ^4.0`nette/neon`^3.3 || ^4.0`doctrine/inflector`^2.0`> **Optional:** `nette/di` is required only when integrating via `MakerExtension` in your Nette DI config.

---

Installation
------------

[](#installation)

```
composer require unquam/nette-maker
```

Since this package is a Composer Plugin, during installation Composer will ask:

Do you trust "unquam/nette-maker" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json) \[y,n,d,?\]

Press `y` to allow. The plugin will automatically create two files in your project root:

FilePurpose`nette`Executable PHP runner — run `php nette ``nette-maker.neon`Configuration file (database credentials, migrations path)If you pressed `n`, create the runner manually:

```
cp vendor/bin/nette-maker nette
chmod +x nette
php nette make:init
```

---

Configuration
-------------

[](#configuration)

Edit `nette-maker.neon` in your project root:

```
# nette-maker.neon
database:
    dsn: 'mysql:host=127.0.0.1;dbname=your_database'
    user: root
    password: ''

migrations:
    directory: db/migrations
```

KeyTypeDescription`database.dsn``string`PDO DSN — driver is auto-detected from the prefix (`mysql`, `pgsql`, `sqlite`, `sqlsrv`)`database.user``string`Database username`database.password``string`Database password`migrations.directory``string`Path relative to the config file where migration files are stored *(default: `db/migrations`)*---

Usage
-----

[](#usage)

All commands are available through the `php nette` runner or through `vendor/bin/nette-maker`.

```
php nette  [arguments] [options]
```

### Available Commands

[](#available-commands)

CommandDescription`make:init`Create the default `nette-maker.neon` config file`make:presenter `Generate a Presenter class`make:model `Generate a Model class`make:repository `Generate a Repository class`make:service `Generate a Service class`make:latte `Generate a Latte template`make:request `Generate an API Form Request validation class`make:request  --web`Generate a Web Frontend Form Request class`make:test `Generate a Nette Tester test class`make:test  --phpunit`Generate a PHPUnit test class`make:module `Generate a full module (all of the above)`make:auth`Scaffold full authentication system`make:resource `Generate a JSON API resource transformer`make:seeder `Generate a database seeder class`make:factory `Generate a database factory class`make:migration `Generate a migration file`migrate`Run pending migrations`migrate --rollback`Roll back all ran migrations`migrate --status`Show migration status`migrate:fresh`Drop all tables and re-run all migrations`migrate:fresh --seed`Drop all tables, re-run migrations and seed`db:seed`Run all database seeders`db:seed --class=Name`Run a specific seeder class`db:wipe`Drop all database tables`clear:cache`Clear application cache directories---

### `make:init`

[](#makeinit)

Creates `nette-maker.neon` in the project root.

```
php nette make:init
```

If the file already exists the command exits with a warning and does nothing.

---

### `make:presenter`

[](#makepresenter)

Generates a Presenter class in `app/Presentation//Presenter.php`.

```
php nette make:presenter Article
# → app/Presentation/Article/ArticlePresenter.php
```

Generated class:

```
