Download the PHP package sllh/iso-codes-validator without Composer
On this page you can find all versions of the php package sllh/iso-codes-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package iso-codes-validator
IsoCodesValidator
Symfony validator wrapper of IsoCodes project.
Installation
First of all, you need to require this library through composer:
After this, you can use it as is.
If you are using it on a Symfony project, you should read the following instructions for a better integration.
As a Symfony bundle
If your project is not using Symfony Full Stack, you must add the following dependencies:
Translations
If you wish to use default validator messages translations in this bundle, you have to make sure you have translator enabled in your config.
Enable the bundle
Usage
IsoCodesValidator is based on Symfony Validator library.
Manual usage
Create and use IsoCodes constraints by using the Symfony Validation class:
With annotations
Validation of objects is possible using "constraint mapping". With such a mapping you can put constraints onto properties and objects of classes. Whenever an object of this class is validated, its properties and method results are matched against the constraints.
Constraints reference
Constraints classes can be found on src/Constraints.
All works "as is" without any options unless message
.
Only ZipCode constraint
accept a country
option to limit validation ('all' by default).
Please note that some IsoCodes classes are already implemented on Symfony Validator component. It's up to you to decide which one to use.
If you think an IsoCodes class is missing, feel free to open an issue or make a PR.
License
This bundle is under the MIT license. See the complete license on the LICENSE file.
TODO
- Try to implement OrganismeType12NormeB2 (Maybe with a special form type?)
- Implement and test xml/yaml assert config for Symfony: http://symfony.com/doc/current/book/validation.html#the-basics-of-validation
All versions of iso-codes-validator with dependencies
ronanguilloux/isocodes Version ^2.3.4
symfony/translation Version ^4.4 || ^5.0
symfony/validator Version ^4.4 || ^5.0