nedra / rest-bundle
Generates a REST api based on your entities
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 0
Open Issues: 2
Type:symfony-bundle
Requires
- doctrine/doctrine-bundle: ^1.6
- doctrine/orm: ^2.5
- friendsofsymfony/rest-bundle: ^2.1
- gedmo/doctrine-extensions: ^2.3.1
- jms/serializer-bundle: ^1.1
- symfony-cmf/routing-bundle: ^2.0
- symfony/dependency-injection: ^3.3
- symfony/framework-bundle: ^3.3
- symfony/http-kernel: ^3.3
- symfony/routing: ^3.3
- symfony/twig-bundle: ^3.3
- symfony/yaml: ^3.3
Requires (Dev)
- phpunit/phpunit: ^5.7
- satooshi/php-coveralls: ^1.0
- symfony/symfony: ^2.8|^3.3
README
NedraRestBundle
NedraRestBundle creates automatically a REST API based on your models. Just give your models and use your auto-generated endpoints.
Get Started
Bundle works on Doctrine ORM based models. Bundle purpose is generate a REST Api in fastest and easy way.
Installation
Step 1: Update composer.json
composer require nedra/rest-bundle
Step 2: Register Classes to AppKernel
[...] new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle($this), new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(), new Nedra\RestBundle\NedraRestBundle(),
Step 3: Update your config.yml
for NedraRestBundle
nedra_rest: active: true # this is default value, you can disable the bundle with set to false entities: app.model: classes: model: AppBundle\Entity\Model
Note
app.model
is a pattern example. You must define your models with application prefix like app
Check Routes
Run that command and debug your router
bin/console debug:router
You will see auto-generated routings for REST
app_model_index GET ANY ANY /models/ app_model_create POST ANY ANY /models/new app_model_update PUT|PATCH ANY ANY /models/{id} app_model_show GET ANY ANY /models/{id} app_model_delete DELETE ANY ANY /models/{id}
Configuration Reference
nedra_rest: entities: app.model: path: model # you can change /models/ to /cars/ except: ['show'] only: ['create', 'index'] classes: model: AppBundle\Entity\Model form: AppBundle\Form\ModelType
Note
You can use only one of them except
or only