saxulum / saxulum-validator-provider
Saxulum Validator Provider (yaml)
Installs: 163 719
Dependents: 2
Suggesters: 0
Security: 0
Stars: 2
Watchers: 0
Forks: 1
Open Issues: 1
Requires
- php: >=5.5.9,<8.0
- doctrine/annotations: ~1.0
- pimple/pimple: >=2.1,<4
- symfony/validator: ~2.3|~3.0
Requires (Dev)
- phpunit/phpunit: ~4.0
- silex/api: ~2.0@dev
- silex/providers: ~2.0@dev
- symfony/config: ~2.3|~3.0
- symfony/yaml: ~2.3|~3.0
This package is not auto-updated.
Last update: 2020-09-22 19:07:06 UTC
README
works with plain silex-php
Features
- Register validators
Requirements
- php >=5.3
- symfony/validator >=2.3
Annotation
- doctrine/annotations ~1.0
Xml
- symfony/config >=2.3
Yaml
- symfony/config >=2.3
- symfony/yaml >=2.3
Installation
Through Composer as saxulum/saxulum-validator-provider.
use Silex\Provider\ValidatorServiceProvider;
use Saxulum\Validator\Provider\SaxulumValidatorProvider;
$container->register(new ValidatorServiceProvider());
$container->register(new SaxulumValidatorProvider());
Annotation
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
XML
Register xml files.
$container['validator.loader.xml.files'] = $container->extend('validator.loader.xml.files', function ($files) {
$files[] = __DIR__ . '/../../Fixtures/test.xml';
return $files;
});
YAML
Register yml files.
$container['validator.loader.yaml.files'] = $container->extend('validator.loader.yaml.files', function ($files) {
$files[] = __DIR__ . '/../../Fixtures/test.yaml';
return $files;
});
Usage
$container['validator']->validate($object);