Skip to content

Commit

Permalink
Merge pull request #6 from maurobonfietti/0.8.0
Browse files Browse the repository at this point in the history
Version 0.8.0
  • Loading branch information
maurobonfietti committed Mar 15, 2020
2 parents 74ed098 + 6b98648 commit 4cc0eab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# CRUD GENERATOR - FOR SLIM 4 - API SKELETON

This package provide a command to generate RESTful endpoints, to manage any simple entity/table.
This package provide a command to generate a CRUD to manage any simple entity/table, in a RESTful API.

Given an resource, like a table in MySQL, autogenerate a simple CRUD endpoints.
Given an resource, like a table in MySQL, auto-generate a simple CRUD endpoints.

For example, if you have a table with the name 'user', the script generate the new endpoints on routes `/user`.

Following the previous example, the command generate 5 (five) new endpoints like:
Following the previous example, the command generate 5 (five) new endpoints:

- Get All Users: `GET /user`
- Get One User: `GET /user/{id}`
- Get Users: `GET /user`
- Create User: `POST /user`
- Get an User: `GET /user/{id}`
- Update User: `PUT /user/{id}`
- Delete User: `DELETE /user/{id}`

So, the script generate a real example with all files and directories: Controller, Services, Repository, etc, etc, that allow you to manage the new resource using as RESTful API.
So, the script generate a real example with all files and directories: Controller, Services, Repository, etc, etc, that allow you to manage the new resource using it like a RESTful API.

Furthermore, the script make a file with PHPUnit tests, for each new endpoint generated.

Expand All @@ -26,8 +26,8 @@ $ ./console api:generate:endpoints [table-name]
OK - Generated endpoints for entity: [table-name]
```

**This package is for exclusive use of this [Slim 4 - Api Skeleton](https://github.com/maurobonfietti/slim4-api-skeleton).**
**This package is for exclusive use of this [Slim 4 - Api Skeleton](https://github.com/maurobonfietti/slim4-api-skeleton) project.**

*Work In Progress...*
**Work In Progress...**
***Work In Progress :-)***
***Work In Progress ;-)***
8 changes: 4 additions & 4 deletions src/Command/CrudGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class CrudGeneratorCommand extends Command
{
const COMMAND_VERSION = '0.7.0';
const COMMAND_VERSION = '0.8.0';

public function __construct($app)
{
Expand All @@ -22,8 +22,8 @@ public function __construct($app)
protected function configure()
{
$this->setName('api:generate:endpoints')
->setDescription('Given an entity, autogenerate a simple CRUD/REST endpoints.')
->setHelp('This command generate RESTful endpoints, to manage any entity. Version: ' . self::COMMAND_VERSION)
->setDescription('Given an entity, auto-generate a simple CRUD endpoints.')
->setHelp('This command generate a CRUD to manage any simple entity/table, in a RESTful API. Version: ' . self::COMMAND_VERSION)
->addArgument(
'entity',
InputArgument::REQUIRED,
Expand All @@ -35,8 +35,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$db = $this->container->get('db');
$entity = $input->getArgument('entity');
$output->writeln('OK - Generated endpoints for entity: ' . $entity);
$generator = new CrudGeneratorService();
$generator->generateCrud($db, $entity);
$output->writeln('OK - Generated endpoints for entity: ' . $entity);
}
}

0 comments on commit 4cc0eab

Please sign in to comment.