Download the PHP package unquam/nette-maker without Composer

On this page you can find all versions of the php package unquam/nette-maker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nette-maker

unquam/nette-maker

PHP Version Tests Packagist Version Packagist Downloads

A CLI code generator for Nette Framework. Scaffold presenters, models, repositories, services, Latte templates, and database migrations with a single command — without touching boilerplate ever again.


Requirements

Dependency Version
PHP >= 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

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:

File Purpose
nette Executable PHP runner — run php nette <command>
nette-maker.neon Configuration file (database credentials, migrations path)

If you pressed n, create the runner manually:


Configuration

Edit nette-maker.neon in your project root:

Key Type Description
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

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

Available Commands

Command Description
make:init Create the default nette-maker.neon config file
make:presenter <Name> Generate a Presenter class
make:model <Name> Generate a Model class
make:repository <Name> Generate a Repository class
make:service <Name> Generate a Service class
make:latte <Name> Generate a Latte template
make:request <Module/Name> Generate an API Form Request validation class
make:request <Module/Name> --web Generate a Web Frontend Form Request class
make:test <Module/Name> Generate a Nette Tester test class
make:test <Module/Name> --phpunit Generate a PHPUnit test class
make:module <Name> Generate a full module (all of the above)
make:auth Scaffold full authentication system
make:resource <Name> Generate a JSON API resource transformer
make:seeder <Name> Generate a database seeder class
make:factory <Name> Generate a database factory class
make:migration <Name> 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

Creates nette-maker.neon in the project root.

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


make:presenter

Generates a Presenter class in app/Presentation/<Name>/<Name>Presenter.php.

Generated class:


make:model

Generates a Model class in app/Model/<Name>.php that uses Nette\Database\Explorer.

Generated class:


make:repository

Generates a Repository class in app/Model/Repositories/<Name>Repository.php.

Generated class includes findAll(): Selection, findById(int $id), create(array $data), update(int $id, array $data): bool and delete(int $id): bool methods pre-wired to the correct database table via a private TABLE constant.


make:service

Generates a Service class in app/Model/Services/<Name>Service.php, pre-injecting the corresponding Repository.


make:latte

Generates an empty Latte template at app/Presentation/<Name>/default.latte.


Form Requests (make:request)

Encapsulate your form input validation logic inside standalone, highly testable Request classes structured beautifully within your Feature Folders.

Generating Requests

By default, it generates an API-specific request class (inside the Api/Requests/{Module} namespace):

To generate a Web Frontend specific request class (inside the Requests/{Module} namespace):

1. Configuration Example (StoreRequest.php)

Define your validation rules using core constraints (required, nullable, sometimes, string, integer, numeric, boolean, array, email, email:rfc, email:dns, email:rfc,dns, url, min:n, max:n, min_length:n, max_length:n, in:a,b, not_in:a,b, regex:/pattern/, confirmed, date, date_format:Y-m-d, before:date, after:date, alpha, alpha_num, alpha_dash, digits:n, digits_between:a,b, between:a,b, ip, ipv4, ipv6, uuid, json, accepted, declined, filled, present, prohibited, size:kb, mimetypes:types).

Note: Use email:dns option with caution in high-traffic production environments, as DNS lookups introduce synchronous network latency.

Rules can be defined as a pipe-separated string or as an array:

2. Multilingual Support (Czech / Multi-lang)

... The RuleValidator uses dynamic placeholder tokens (:field, :min, :max, :values). You can easily return error messages in Czech (or any other language) by overriding them directly in the messages() method of your request class, or by passing translated strings through your architecture.

Example Czech Output Mapping:

If you override messages for Czech localization:

Usage in Presenters (Safe Action Flow)

Case A: Usage in a REST API Presenter (JSON Output)

Czech API Validation Failure Output (422 Client Error):

Case B: Usage in a Web Frontend Presenter (HTML Forms with Redirect)

3. Database Validation (unique / exists)

Pass the Explorer instance as second constructor argument to enable database-backed rules:

Usage in Presenter:

If Explorer is not passed, unique and exists rules are silently skipped.


Test Generation

make:test

Generate test classes for Nette Tester (default) or PHPUnit. The command automatically analyzes the target class using reflection and scaffolds test methods for all its public actions.

💡 Note: To run default tests, make sure you have nette/tester in your dev dependencies.

Interactive Mode

If you run the command without arguments, it will ask for the class name interactively:

Real-world Nested Example

If your project has a deep folder structure (e.g., app/Model/Security/Authenticator.php), just pass the path relative to your app directory:

The tool will dynamically build the correct nested test structure:

Smart Features:


make:module

Scaffolds a complete module in one command: Presenter, Model, Repository, Service, Migration, and Latte template.

All parts are optional. Skip specific ones with --no-* flags:

Generate only specific parts with --only:

Comma-separated values accepted: presenter, model, repository, service, migration, latte.


Authentication Scaffolding (make:auth)

Scaffold a fully operational authentication, registration, and logout system out-of-the-box. It automatically generates a secure database schema migration table script, custom security Authenticator model services compliant with Nette Security standards, controller presenter forms logic handlers, and responsive front-end view templates layouts:

What gets generated:

Activation setup rules:

Once generated, simply wire up the fresh class service structure boundary mapping inside your core Nette application DI container tracking block configuration setup (config.neon layout configuration file):

Afterward, instantly run your migrations schema setup to provision your backend database tracking table structures allocation layouts:


API Resources & Collections (make:resource)

Transform your database models into secure, structured JSON layers with native support for Nette Framework pagination.

Generating Resources

To generate a single item transformer resource (extends JsonResource):

To generate a paginated resource collection transformer (extends ResourceCollection):

1. The Single Item Resource (UserResource.php)

Safely filter your database fields inside the toArray() block to prevent sensitive credentials leaks:

2. The Resource Collection (UserCollection.php)

Define which single item resource class should map the nesting loop:

Usage in Presenters

Case A: Single Item Response
Case B: Paginated Collection Response

Natively maps Nette Database query streams (Selection) combined with pagination settings out-of-the-box:

JSON Output Format:

🔐 REST API Authentication Integration

If you need to protect these generated JSON endpoints with lightweight, secure bearer access/refresh tokens, use our native companion API package:

👉 unquam/nette-api-auth

It provides full token life-cycle management, strict CORS controls, and built-in rate-limiting filters out-of-the-box.


make:seeder

Generates a database seeder class stub.

Configure the seeders directory in nette-maker.neon:


Data Factories (make:factory)

Generate powerful blueprint schemas for your database records to simplify seeding and testing.

Configure your custom factories lookup directory path inside nette-maker.neon:

Inside the Factory Class

Each generated factory is a structured PHP class extending AbstractFactory. You can easily map default attributes using standard PHP or external libraries like Faker:

Usage in Seeders

Since generated blueprints are native PHP classes, you get complete IDE autocompletion. Simply instantiate the factory inside your seeders context loop using a standard object constructor:


make:migration

Generates a timestamped migration file in the configured migrations directory.

Generated migration:

TableBuilder API

Supported database drivers: mysql, mariadb, pgsql/postgres, sqlite, sqlsrv/mssql.


migrate

Run all pending migrations:

Show migration status:

Roll back all ran migrations:


migrate:fresh

Drops all database tables completely and re-runs all migration scripts sequentially from scratch. This provides a fresh starting state for local development:

You can automatically run database seeders right after resetting your database schema using the --seed (or -s) shortcut flag:


db:seed

Run all available seeders alphabetically:

Run a specific seeder class directly using the --class (or -c) option:


db:wipe

Completely drops all tables from the database without running down() migration methods. It safely disables foreign key constraints internally during the process:


clear:cache

Safely clears application cache and maintenance directories.

By default, it targets the temp/ folder. It uses smart isolation: inside the standard Nette temp/ directory, it removes only the compiled configuration and templates (temp/cache/ and temp/proxies/), strictly ignoring temp/session/ so active web users won't log out.

You can configure multiple custom directories to be fully cleared inside your nette-maker.neon configuration array:


Interactive Prompts

All code generation commands support a smart interactive mode. If you forget to provide the name argument, the CLI will prompt you for it in real-time:


Directory Structure Generated

Running the commands creates files in the following locations (all relative to your project root by default, or to the directory containing nette-maker.neon when using the nette runner):


Integration with Nette DI (MakerExtension)

If your project uses nette/di, you can register all commands as services and wire them into your Symfony Console application via the DI extension.

1. Register the extension in your config.neon

2. Use the Application service in your bootstrap

The extension registers every make:* command and the migrate command as individual DI services. This allows them to participate in standard DI autowiring.


Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feat/my-feature.
  3. Write tests for any new behaviour in tests/.
  4. Ensure the test suite passes: composer test.
  5. Follow PSR-12 coding standards.
  6. Open a pull request against the main branch.

License

This package is open-sourced software licensed under the MIT licence.


All versions of nette-maker with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
composer-plugin-api Version ^2.0
symfony/console Version ^5.0||^6.0||^7.0
nette/php-generator Version ^3.5||^4.0
nette/neon Version ^3.3||^4.0
doctrine/inflector Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package unquam/nette-maker contains the following files

Loading the files please wait ...