2017 © Pedro PelĂĄez
 

symfony-bundle zz-validation-extra-bundle

Provides a set of extras validation constraints.

image

zzortell/zz-validation-extra-bundle

Provides a set of extras validation constraints.

  • Monday, January 12, 2015
  • by Zzortell
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

ZzValidationExtraBundle

Get more validation constraints !, (*1)

Installation

Step 1: Download the bundle using composer, (*2)

Add the bundle by running:, (*3)

``` bash composer require zzortell/zz-validation-extra-bundle, (*4)


**Step 2: Enable the bundle** ``` php <?php // app/AppKernel.php class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Zz\ValidationExtraBundle\ZzValidationExtraBundle(), // ... ); } }

Step 3: Enjoy !, (*5)

Usage

The Color constraint

Use the Color constraint like any validation constraint of the symfony/Validator component. For example, with annotations: ``` php <?php, (*6)

use Zz\ValidationExtraBundle\Validator\Constraints as Extras;, (*7)

class MyClass { /** * Simple usage: * @Extras\Color */ protected $color = '#222a6e';, (*8)

/**
 * All options with theirs default values:
 * @Extras\Color(formats="All", message="The color supplied (%color%) is invalid (for formats: %formats%).", requireHash=true)
 */
protected $color = '#222a6e';

/**
 * Complex usage:
 * @Extras\Color({"hex", "cssname"}, requireHash=false)
 */
protected $color = '#222a6e';

} ```, (*9)

Properties: - formats: is the default option. It can be a string or an array of strings. Values: "All" (string only), "Hex", "Name" ("HtmlName"+CssName""), "HtmlName", CssName"". - message: Available variables: %color%, %formats%. - requireHash: for hex colors. Values: null (doesn't worry) or boolean., (*10)

You can also use the following constraints, inheriting of Color: - HexColor - NameColor - CssNameColor - HtmlNameColor, (*11)

For these constraints, message is the default option., (*12)

Don't hesitate to have a look on Validator/Constraints., (*13)

Notice

If you don't want to get future features and just use colors constraints, require only 1.0.* versions. Every future features will increment the minor number., (*14)

Todo

In the 1.0 branch: - Use services' tag system instead of keeping in memory the formats in Validator/Constraints/ColorValidator.php - Add the support of rgb, rgba, hsl, hsla formats - Add a webSafe property, (*15)

In the 1.1 branch: - Add a color format convertor ?, (*16)

Contributing

If you have any idea for improving the bundle or if you find a bug, please post an issue. If you want to help me, especially for correcting my english, please don't hesitate., (*17)

Credits

This bundle his inspired by the ollietb's HexColor constraint and his validator. * RĂ©mi Blaise (Zzortell) as the author. * Ollie Harridge (olliet) for original HexColor constraint., (*18)

License

This bundle is under the MIT license. See the complete license in the bundle:, (*19)

Resources/meta/LICENSE

A part of this bundle comes from ollieLtd/OhColorPickerTypeBundle. Please see this notice:, (*20)

Resources/meta/NOTICE.md

The Versions

12/01 2015

dev-master

9999999-dev https://github.com/Zzortell/ZzValidationExtraBundle

Provides a set of extras validation constraints.

  Sources   Download

MIT

The Requires

 

The Development Requires

validation symfony constraints

12/01 2015

v1.0.2

1.0.2.0 https://github.com/Zzortell/ZzValidationExtraBundle

Provides a set of extras validation constraints.

  Sources   Download

MIT

The Requires

 

The Development Requires

validation symfony constraints

11/01 2015

v1.0.1

1.0.1.0 https://github.com/Zzortell/ZzValidationExtraBundle

Provides a set of extras validation constraints.

  Sources   Download

MIT

The Requires

 

The Development Requires

validation symfony-bundle constraints

11/01 2015

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires