royopa/respect-validation-service-provider

Respect Validation Service Provider to use with Silex microframework

dev-master 2015-03-17 17:35 UTC

This package is auto-updated.

Last update: 2024-10-29 04:41:54 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Provides Respect Validation to use with Silex microframework.

http://documentup.com/Respect/Validation/

Requirements

  • PHP 5.3+
  • Respect/Validation

Instalation

Package available on Composer. Autoloading with composer is PSR-0 compatible.

$ composer require "royopa/respect-validation-service-provider": "dev-master"

Or

You can include the following in your composer.json file:

{
    "require": {
        "royopa/respect-validation-service-provider": "dev-master"
    }
}

Usage

To use the provider, register RespectValidationServiceProvider.

<?php
    use Silex\Application;
    use Royopa\Silex\Provider\Respect\Validation\RespectValidationServiceProvider;

    $app = new Application;

    $app->register(new RespectValidationServiceProvider());

The default Validator will now be accessible with respect.validator in the app container.

<?php
    $validator = $app['respect.validator'];

    $number = 123;
    $validator::numeric()->validate($number); //true

Enjoy!