dev-master
9999999-devProvides a REST-like API for the Doctrine entities in a Symfony application.
The Requires
rest doctrine
v1.0
1.0.0.0Provides a REST-like API for the Doctrine entities in a Symfony application.
The Requires
rest doctrine
Wallogit.com
2017 © Pedro Peláez
Provides a REST-like API for the Doctrine entities in a Symfony application.
The OutlandishRestBundle provides a REST-like API for the Doctrine entities in a Symfony application. It is highly
opinionated and requires no configuration which makes it an excellent choice for rapid prototyping with JavaScript
frameworks such as Angular, Ember and Backbone., (*1)
Features:, (*2)
For example if you have Acme\FooBundle\Entity\Bar then you can do the following:, (*3)
GET /api/bar
// returns [{"id":1, ...}, {"id":2, ...}]
GET /api/bar/1
// returns {"id":1, ...}
POST /api/bar
{"foo":"baz", ...}
// returns {"id":3, "foo":"baz", ...}
PUT /api/bar/2
{"foo":"buzz", ...}
// returns {"id":2, "foo":"buzz", ...}
DELETE /api/bar/3
// returns nothing
GET /api/bar?id=gt=2&foo=baz
// returns [{"id":3, ...}]
GET /api/bar?per_page=2&offset=1
// returns [{"id":2, ...}, {"id":3, ...}]
GET /api/bar/0
// returns [{"message":"Entity not found"}]
POST and PUT requests expect JSON encoded entity data in the request body., (*4)
On error, a status code of 400, 404 or 500 is returned and the response body is an array of messages., (*5)
composer.json
"require": {
"outlandish/rest-bundle": "dev-master",
},
composer update
AppKernel.php
public function registerBundles()
{
$bundles = array(
//...
new Outlandish\RestBundle\OutlandishRestBundle(),
);
return $bundles;
}
app/config/routing.yml
#...
outlandish_rest:
resource: .
type: outlandish_rest
prefix: /api
Provides a REST-like API for the Doctrine entities in a Symfony application.
rest doctrine
Provides a REST-like API for the Doctrine entities in a Symfony application.
rest doctrine