dev-master
9999999-devPhprest Validator Service.
MIT
The Requires
- php >=5.4.0
- phprest/phprest dev-master
- symfony/validator ~2.5.6
by Adam Balogh
api service framework rest validator restful
Phprest Validator Service.
Validator Service which uses the Symfony\Validator component., (*2)
Install it through composer., (*3)
{ "require": { "phprest/phprest-service-validator": "@stable" } }
tip: you should browse the phprest/phprest-service-validator
page to choose a stable version to use, avoid the @stable
meta constraint., (*4)
For the configuration you should check the Config class., (*5)
use Phprest\Service\Validator; # ... /** @var \Phprest\Application $app */ $app->registerService(new Validator\Service(), new Validator\Config()); # ...
To reach your Service from a Controller you should use the Service's Getter Trait., (*6)
<?php namespace App\Module\Controller; use Phprest\Service; class Index extends \Phprest\Util\Controller { use Service\Validator\Getter; public function post(Request $request) { $this->serviceValidator()->validate(...); } }
Most of the Services in Phprest provides some utility mechanism (helper functions)., (*7)
For the utilities you should check the Util class., (*8)
Phprest Validator Service.
MIT
api service framework rest validator restful