hch / normalizedrestapi-bundle
A bundle to normalize the return of Rest API
Package info
github.com/lechaabani/HCHNormalizedRestApiBundle
Type:symfony-bundle
pkg:composer/hch/normalizedrestapi-bundle
dev-develop
2016-10-29 23:23 UTC
Requires
- php: >=5.3.2
- hch/normalizedrestapi-bundle: dev-master
- symfony/console: ~2.0
- symfony/framework-bundle: ~2.0
- symfony/serializer: ~2.0
This package is not auto-updated.
Last update: 2026-03-01 03:47:57 UTC
README
A bundle to normalize the return of Rest API
Installation
Run composer require hch/normalizedrestapi-bundle=dev-master
Create erros_code.ini file: php app/console app:create-error-code
Basic Usage
The bundle can be used as simply as this
<?php
use HCH\NormalizedRestApiBundle\ApiException\ApiException;
use HCH\NormalizedRestApiBundle\ApiResponse\ApiResponse;
public function getProductAction(Product $product) {
if(!$product){
throw new ApiException(404);
}
return new ApiResponse(array('Product' => $product));
}