Usage Guide¶
This guide explains how to use the Elegant Maker Bundle to generate code for your Symfony application.
Basic Usage¶
All commands provided by this bundle follow the naming convention make:elegant:*. You can list all available commands by running:
Command Structure¶
Most commands follow this general structure:
Where:
- <generator> is the type of code you want to generate
- <name> is the name of the class or component you want to create
- [options] are additional parameters to customize the generation
Available Generators¶
The bundle provides several generators for different types of code:
- Class Generator: Generate simple PHP classes
- More generators coming soon...
Common Options¶
Most generators support these common options:
--namespace: The namespace for the generated code (defaults toApp)--dir: The directory where the code will be generated (defaults tosrc)
Examples¶
Generate a Simple Class¶
This will generate a simple class named User in the default namespace (App).
Generate a Class with Custom Namespace¶
This will generate a class named User in the App\Domain\Model namespace.
Generate a Class that Extends Another Class¶
This will generate a class named Admin that extends the User class.
Generate a Class that Implements Interfaces¶
php bin/console make:elegant:class Repository --implements="App\Domain\Repository\RepositoryInterface" --implements="Countable"
This will generate a class named Repository that implements both the RepositoryInterface and Countable interfaces.
Next Steps¶
- Learn about specific generators in the Generators section
- Create your own custom generators by following the Custom Generators guide