PHPackages                             braincrafted/validation-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. braincrafted/validation-bundle

ActiveSymfony-bundle[Validation &amp; Sanitization](/categories/validation)

braincrafted/validation-bundle
==============================

Validators for Symfony2

v0.3(12y ago)51192MITPHPPHP &gt;=5.3.3CI failing

Since Jul 8Pushed 12y ago1 watchersCompare

[ Source](https://github.com/braincrafted/validation-bundle)[ Packagist](https://packagist.org/packages/braincrafted/validation-bundle)[ RSS](/packages/braincrafted-validation-bundle/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)Dependencies (2)Versions (8)Used By (0)

BraincraftedValidationBundle
============================

[](#braincraftedvalidationbundle)

Handcrafted in Vienna by [Florian Eckerstorfer](http://florianeckerstorfer.com).

[![Build Status](https://camo.githubusercontent.com/41a8b018315785a9e858b2c3ad93112fbee148d7b96214ee1b631f9dcdb6ebe5/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f627261696e637261667465642f76616c69646174696f6e2d62756e646c652e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/braincrafted/validation-bundle)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/bb87a17d932a14ac0f20e4e0707befce4f61cb892de8d6c1f2e78835972cf35e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f627261696e637261667465642f76616c69646174696f6e2d62756e646c652f6261646765732f7175616c6974792d73636f72652e706e673f733d36643530613231613933633338666531613261363532376561616136343037396461633339346335)](https://scrutinizer-ci.com/g/braincrafted/validation-bundle/)[![Code Coverage](https://camo.githubusercontent.com/3e0e6a5cb9280ea1a711ef78c44e681f408d753da3993ff0befacb62c3665618/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f627261696e637261667465642f76616c69646174696f6e2d62756e646c652f6261646765732f636f7665726167652e706e673f733d35306236306535346263303639313330313734383339306538633765373436333665643162663533)](https://scrutinizer-ci.com/g/braincrafted/validation-bundle/)

Installation
------------

[](#installation)

**BraincraftedValidationBundle** can be installed using Commposer.

```
{
    "require": {
        "braincrafted/validation-bundle": "@stable"
    }
}
```

Replace `@stable` with the latest stable release.

Usage
-----

[](#usage)

If **BraincraftedValidationBundle** has been added to the project, its validators can be used just like every other Symfony2 validator.

### Using with YAML

[](#using-with-yaml)

```
# src/Acme/BlogBundle/Resources/config/validation.yml
Acme\DemoBundle\Entity\AcmeEntity:
    properties:
        name:
            - NotBlank: ~
            - Braincrafted\Bundle\ValidationBundle\Validator\Constraints\Enum:
                allowedValues: ["ACTIVE", "PAUSED", "DELETED"]
```

### Using with Annotations

[](#using-with-annotations)

```
// src/Acme/DemoBundle/Entity/AcmeEntity.php
use Symfony\Component\Validator\Constraints as Assert;
use Braincrafted\Bundle\ValidationBundle\Validator\Constraints as BraincraftedAssert;

class AcmeEntity
{
    // ...
    /**
     * @Assert\NotBlank
     * @BraincraftedAssert\Enum(allowedValues={"ACTIVE", "PAUSED, "DELETED""})
     */
    protected $status;
    // ...
}
```

### Using with XML

[](#using-with-xml)

```

                    ACTIVE
                    PAUSED
                    DELETED

```

### Using with PHP

[](#using-with-php)

```
// src/Acme/DemoBundle/Entity/AcmeEntity.php
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\NotBlank;
use Braincrafted\Bundle\ValidationBundle\Validator\Constraints\Enum;

class AcmeEntity
{
    public $name;

    public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint('status', new NotBlank());
        $metadata->addPropertyConstraint('status', new Enum(array('ACTIVE', 'PAUSED', 'DELETED')));
    }
}
```

Available Validators
--------------------

[](#available-validators)

### Enum

[](#enum)

- Options:
    - `string` message
    - `array` allowedValues

Changelog
---------

[](#changelog)

### Version 0.3 (21 November 2013)

[](#version-03-21-november-2013)

- \#6: Fixed error message \[by [Tobur](https://github.com/Tobur)\]

### Version 0.2 (17 November 2013)

[](#version-02-17-november-2013)

- Changed namespace to `Braincrafted\Bundle\ValidationBundle`

License
-------

[](#license)

### The MIT License (MIT)

[](#the-mit-license-mit)

Copyright (c) 2012-2013 Florian Eckerstorfer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[![Bitdeli Badge](https://camo.githubusercontent.com/a46bd0b90cd7618b8a32098b81d469e1903063a50566f89691f203ab5505423f/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f627261696e637261667465642f76616c69646174696f6e2d62756e646c652f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~41 days

Total

7

Last Release

4528d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a80f9fc61cd3a7d7779e8f120b458ca4d18fdd885d719bb77d3379b96bf714d9?d=identicon)[florianeckerstorfer](/maintainers/florianeckerstorfer)

---

Top Contributors

[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![mhor](https://avatars.githubusercontent.com/u/4103719?v=4)](https://github.com/mhor "mhor (1 commits)")[![punkeel](https://avatars.githubusercontent.com/u/1859135?v=4)](https://github.com/punkeel "punkeel (1 commits)")

---

Tags

validation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/braincrafted-validation-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/braincrafted-validation-bundle/health.svg)](https://phpackages.com/packages/braincrafted-validation-bundle)
```

###  Alternatives

[karser/karser-recaptcha3-bundle

Google ReCAPTCHA v3 for Symfony

1862.4M7](/packages/karser-karser-recaptcha3-bundle)[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[fp/jsformvalidator-bundle

Javascript validation for sf\[2|3|4\] forms.

132418.8k1](/packages/fp-jsformvalidator-bundle)[kdyby/validator

Integration of Symfony/Validator into Nette Framework

10128.1k4](/packages/kdyby-validator)[j-ben87/parsley-bundle

Convert Symfony constraints into data-attributes for client-side validation with Parsley.

1432.7k](/packages/j-ben87-parsley-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
