manticora / rest-extra-bundle
Utilities for Symfony Rest Services
0.1
2014-04-14 10:54 UTC
Requires
- symfony/expression-language: ~2.4
- symfony/framework-bundle: ~2.3
- symfony/routing: ~2.4
This package is not auto-updated.
Last update: 2024-11-05 07:38:56 UTC
README
Utilities for Symfony Rest Services
Usage
Router Expression Language Injection
Injecting the Router expression Language you can use the the custom Expression Language class in the routing conditions, this class contains the PHP version_compare function for versioning rest web services
/** * @Get("notes", condition="compare(request.attributes.get('version'),'1', '<')") */ public function cgetAction() { return $this->getRepository()->findAll(); } /** * @Get("notes", condition="compare(request.attributes.get('version'),'1', '>=')") */ public function cgetNewVersionAction() { echo 'new version'; return $this->getRepository()->findAll(); }
Installation
Download Packages
Add the following lines in your composer.json
file:
{ "require": { "manticora/rest-extra-bundle": "0.1" } }
Now, run composer.phar to download the bundle:
$ php composer.phar install
Note: You can immediately start using it. The autoloading files have been generated by composer and already included to the app autoload file.
Step 2: Enable the bundle
Finally, enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Manticora\RestExtraBundle\ManticoraRestExtraBundle(), ); }
TODO
- Json Patch
- Url Matcher rewrite
- AbstractHalRepository
- Hal Test Utility
- JMS Serializer Group Strategy rewrite
- Paginated Representation rewrite
License
RestExtraBundle is released under the MIT License. See the bundled LICENSE file for details.