logist / movizor-api-bundle
Symfony Bundle for Movizor.ru REST API
1.4.2
2018-05-21 12:26 UTC
Requires
- php: >=5.6
- symfony/symfony: >=2.8
Requires (Dev)
- phpunit/phpunit: >=5.7
README
Symfony Bundle for Movizor.ru REST API
Requires
- php: >=5.6
- symfony/symfony: 2.8.*
Install
Composer
#!console
> composer require logist/movizor-api-bundle
Setup
#!yaml
#app/Resurces/config/config.yml
translator:
fallbacks: ["%locale%"]
paths:
- "%kernel.root_dir%/../vendor/logist/movizor-api-bundle/src/Logist/Movizor/Resources/translations"
movizor_api:
url: 'http://movizor.ru/api/'
projects:
'%movizor_projects%'
#!yaml
#app/Resurces/config/parameters.yml
movizor_projects:
project_name: 'api_key'
Usage
#!php
/* DefaultController.php */
//...
/**
* @Route("/movizor/", name="movizor")
*/
public function movizor(Request $request)
{
$movizor = $this->get('logist.movizor.project_api');
$response = $movizor->getPos('88000000000');
if($response->code === 'OK'){
$result['data'] = $response->data;
}
$result['errors'] = $movizor->getErrorStack();
return new JsonResponse($result);
}
//...