-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from atournayre/feature/new_version
First version
- Loading branch information
Showing
257 changed files
with
15,215 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.github export-ignore | ||
docs export-ignore | ||
tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,6 @@ | ||
.env | ||
composer.lock | ||
symfony.lock.lock | ||
/vendor/ | ||
composer.lock | ||
|
||
###> symfony/framework-bundle ### | ||
/.env.local | ||
/.env.local.php | ||
/.env.*.local | ||
/config/secrets/prod/prod.decrypt.private.php | ||
/public/bundles/ | ||
/var/ | ||
/vendor/ | ||
###< symfony/framework-bundle ### | ||
# PHPUnit | ||
.phpunit.cache | ||
.phpunit.result.cache |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,90 @@ | ||
# Maker Bundle | ||
# MakerBundle | ||
|
||
This bundle Extend Symfony Maker Bundle. | ||
## Installation | ||
|
||
## Requirements | ||
Symfony ``6.2.*`` | ||
Make sure Composer is installed globally, as explained in the | ||
[installation chapter](https://getcomposer.org/doc/00-intro.md) | ||
of the Composer documentation. | ||
|
||
PHP ``>=8.1`` | ||
### Step 1: Download the Bundle | ||
|
||
## Install | ||
### Composer | ||
```shell | ||
composer require atournayre/maker-bundle | ||
Open a command console, enter your project directory and execute the | ||
following command to download the latest stable version of this bundle: | ||
|
||
```console | ||
composer require atournayre/maker-bundle --dev | ||
``` | ||
### Register bundle | ||
|
||
### Step 2: Enable the Bundle | ||
|
||
Then, enable the bundle by adding it to the list of registered bundles | ||
in the `config/bundles.php` file of your project: | ||
|
||
```php | ||
// config/bundles.php | ||
|
||
return [ | ||
// ... | ||
new \Atournayre\Bundle\Maker\AtournayreMakerBundle(), | ||
// ... | ||
] | ||
Atournayre\Bundle\MakerBundle\AtournayreMakerBundle::class => ['dev' => true], | ||
]; | ||
``` | ||
|
||
### Step 3: Configure the Bundle | ||
|
||
```yaml | ||
# config/packages/atournayre_maker.yaml | ||
|
||
atournayre_maker: | ||
root_namespace: 'App' | ||
``` | ||
## Contributing | ||
Of course, open source is fueled by everyone's ability to give just a little bit | ||
of their time for the greater good. If you'd like to see a feature or add some of | ||
your *own* happy words, awesome! Tou can request it - but creating a pull request | ||
is an even better way to get things done. | ||
#### Debug configuration | ||
- default configuration `php bin/console config:dump atournayre_maker`. | ||
- current configuration `php bin/console debug:config atournayre_maker`. | ||
|
||
## Documentation | ||
|
||
### Commands | ||
|
||
Legend: | ||
- ⚠️: Experimental command. | ||
- 🚧: Command to be implemented. | ||
- ✅: Command implemented. | ||
|
||
| Status | Command | Description and documentation | | ||
|--------|-------------------------------|-------------------------------------------------------------------------| | ||
| ✅️ | `make:add:events-to-entities` | [Add events to entities](docs/add-events-to-entities.md) | | ||
| ✅️ | `make:new:command` | [Create a new Command](docs/new-default.md) | | ||
| ⚠️ | `make:new:controller` | [Create a new Controller](docs/new-default.md) | | ||
| ✅️ | `make:new:collection` | [Create a new Collection](docs/new-default.md) | | ||
| ✅ | `make:new:dto` | [Create a new DTO](docs/new-default.md) | | ||
| ✅ | `make:new:enum` | [Create a new Enum](docs/new-default.md) | | ||
| ✅ | `make:new:event` | [Create a new Event and Listener](docs/new-default.md) | | ||
| ✅ | `make:new:exception` | [Create a new Exception](docs/new-default.md) | | ||
| ✅ | `make:new:interface` | [Create a new Interface](docs/new-default.md) | | ||
| ✅ | `make:new:logger` | [Create a new Logger](docs/new-logger.md) | | ||
| ✅ | `make:new:service` | [Create a new Service](docs/new-service.md) | | ||
| ✅ | `make:new:trait` | [Create a new Trait](docs/new-default.md) | | ||
| ✅ | `make:new:vo` | [Create a new VO](docs/new-default.md) | | ||
| ✅ | `project:getting-started` | [Add minimal files to start a project](docs/project-getting-started.md) | | ||
|
||
## Create a new Maker | ||
|
||
### Step 1: Create the Configuration class | ||
1. Create a new class in the `Config` directory. | ||
2. Extend the `MakerConfiguration` class. | ||
3. If you need extra configuration, create as many properties, getters and withers as needed. | ||
4. If you want to add suffixes to the class name, override the `classNameSuffix` method. | ||
|
||
### Step 2: Create the Builder class | ||
1. Create a new class in the `Builder` directory. | ||
2. Extend the `AbstractBuilder` class. | ||
3. Implement the methods. | ||
4. Add the `#[AutoconfigureTag('atournayre_maker.php_file_builder')]` attribute to the class. | ||
|
||
### Step 3: Create the Maker class | ||
1. Create a new class in the `Maker` directory. | ||
2. Extend the `AbstractMaker` class. | ||
3. Implement the methods. | ||
4. Add the `#[AutoconfigureTag('maker.command')]` attribute to the class. | ||
|
||
Either way, please feel comfortable submitting issues or pull requests: all contributions | ||
and questions are warmly appreciated :). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,52 @@ | ||
{ | ||
"name": "atournayre/maker-bundle", | ||
"description": "This bundle adds functionalities to Symfony Maker Bundle.", | ||
"type": "symfony-bundle", | ||
"license": "MIT", | ||
"keywords": ["generator", "code generator", "scaffolding", "scaffold"], | ||
"authors": [ | ||
{ | ||
"name": "atournayre", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Atournayre\\Bundle\\MakerBundle\\": "src/" | ||
} | ||
}, | ||
"description": "This bundle extend Symfony Maker Bundle and helps you create lots of files so you can forget about writing boilerplate code and it also provide minimal files to start a project.", | ||
"keywords": ["generator", "code generator", "scaffolding", "scaffold", "dev", "commands", "controllers", "collections", "DTO", "VO", "events", "interfaces", "logger", "services", "traits"], | ||
"minimum-stability": "stable", | ||
"require": { | ||
"php": ">=8.1", | ||
"symfony/flex": "^2.2", | ||
"symfony/console": "6.2.*", | ||
"symfony/http-kernel": "6.2.*", | ||
"symfony/dependency-injection": "6.2.*", | ||
"symfony/maker-bundle": "^1.48", | ||
"symfony/config": "6.2.*" | ||
"atournayre/collection": "^0.8.0", | ||
"atournayre/types": "^0.9.0", | ||
"nette/php-generator": "^4.1", | ||
"symfony/framework-bundle": "^6.4|^7.0", | ||
"symfony/maker-bundle": "^1.56", | ||
"symfony/mime": "^6.4|^7.0", | ||
"symfony/twig-bundle": "^6.4|^7.0", | ||
"symfony/yaml": "^6.4|^7.0", | ||
"webmozart/assert": "^1.11" | ||
}, | ||
"config": { | ||
"sort-packages": true | ||
}, | ||
"extra": { | ||
"symfony": { | ||
"allow-contrib": true, | ||
"require": "6.2.*", | ||
"endpoint": [ | ||
"https://api.github.com/repos/atournayre/symfony-flex-recipes/contents/index.json", | ||
"flex://defaults" | ||
] | ||
"autoload": { | ||
"psr-4": { | ||
"Atournayre\\Bundle\\MakerBundle\\": "src/", | ||
"App\\": "src/Resources/templates" | ||
} | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"symfony/flex": true | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Atournayre\\Bundle\\MakerBundle\\Tests\\": "tests/" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpstan/phpdoc-parser": "^1.29", | ||
"phpstan/phpstan": "^1.10", | ||
"phpstan/phpstan-symfony": "^1.3", | ||
"phpunit/phpunit": "^10.5", | ||
"rector/rector": "^1.0", | ||
"spaze/phpstan-disallowed-calls": "^3.3" | ||
}, | ||
"scripts": { | ||
"auto-scripts": { | ||
"cache:clear": "symfony-cmd", | ||
"assets:install %PUBLIC_DIR%": "symfony-cmd" | ||
} | ||
"test": "phpunit", | ||
"phpstan": "phpstan analyse src", | ||
"rector": "rector process src", | ||
"qa": [ | ||
"@phpstan", | ||
"@rector", | ||
"@test" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use Atournayre\Bundle\MakerBundle\Maker\MakeAddEventsToEntities; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeCollection; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeCommand; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeController; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeDto; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeEnum; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeEvent; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeException; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeInterface; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeLogger; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeProjectInstall; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeService; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeTrait; | ||
use Atournayre\Bundle\MakerBundle\Maker\MakeVo; | ||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; | ||
|
||
return static function (ContainerConfigurator $container): void { | ||
$services = $container->services(); | ||
|
||
$services | ||
->defaults() | ||
->private() | ||
->autowire() | ||
; | ||
|
||
$makers = [ | ||
MakeAddEventsToEntities::class, | ||
MakeCollection::class, | ||
MakeCommand::class, | ||
MakeController::class, | ||
MakeDto::class, | ||
MakeEnum::class, | ||
MakeEvent::class, | ||
MakeException::class, | ||
MakeInterface::class, | ||
MakeLogger::class, | ||
MakeProjectInstall::class, | ||
MakeService::class, | ||
MakeTrait::class, | ||
MakeVo::class, | ||
]; | ||
|
||
foreach ($makers as $maker) { | ||
$services | ||
->set($maker) | ||
->arg('$rootDir', '%kernel.project_dir%/src') | ||
->tag('maker.command') | ||
; | ||
} | ||
}; |
Oops, something went wrong.