saxulum/saxulum-validator-provider

This package is abandoned and no longer maintained. No replacement package was suggested.

Saxulum Validator Provider (yaml)

2.1.1 2015-12-19 17:34 UTC

This package is not auto-updated.

Last update: 2020-09-22 19:07:06 UTC


README

works with plain silex-php

Build Status Total Downloads Latest Stable Version Scrutinizer Code Quality

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);