|
| 1 | +[](https://travis-ci.com/ulrack/validator) |
| 2 | + |
| 3 | +# Ulrack Validator |
| 4 | + |
| 5 | +This package contains an interface and a handful of validators. These validators |
| 6 | +will validate a predetermined type of data against a single (or set of) rule(s). |
| 7 | +If the type does not match it will always return true. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +To install the package run the following command: |
| 12 | + |
| 13 | +``` |
| 14 | +composer require ulrack/validator |
| 15 | +``` |
| 16 | + |
| 17 | +## Usage |
| 18 | + |
| 19 | +The validators are sorted by their type they will validate against. |
| 20 | + |
| 21 | +### Chain |
| 22 | + |
| 23 | +Chain validators are validators which verify the outcome of multiple nested |
| 24 | +validators against data and contain their own logic. |
| 25 | + |
| 26 | +- [AndValidator](src/Component/Chain/AndValidator.php) |
| 27 | +- [OrValidator](src/Component/Chain/OrValidator.php) |
| 28 | +- [OneOfValidator](src/Component/Chain/OneOfValidator.php) |
| 29 | + |
| 30 | +### Iterable |
| 31 | + |
| 32 | +Iterable validators work with numeric arrays. |
| 33 | + |
| 34 | +- [ContainsValidator](src/Component/Iterable/ContainsValidator.php) |
| 35 | +- [ItemsValidator](src/Component/Iterable/ItemsValidator.php) |
| 36 | +- [MaxItemsValidator](src/Component/Iterable/MaxItemsValidator.php) |
| 37 | +- [MinItemsValidator](src/Component/Iterable/MinItemsValidator.php) |
| 38 | +- [UniqueItemsValidator](src/Component/Iterable/UniqueItemsValidator.php) |
| 39 | + |
| 40 | +### Logical |
| 41 | + |
| 42 | +Logical validators are type independent logical validators. |
| 43 | + |
| 44 | +- [AlwaysValidator](src/Component/Logical/AlwaysValidator.php) |
| 45 | +- [ConstValidator](src/Component/Logical/ConstValidator.php) |
| 46 | +- [EnumValidator](src/Component/Logical/EnumValidator.php) |
| 47 | +- [IfThenElseValidator](src/Component/Logical/IfThenElseValidator.php) |
| 48 | +- [NotValidator](src/Component/Logical/NotValidator.php) |
| 49 | + |
| 50 | +### Numeric |
| 51 | + |
| 52 | +Numeric validators work with numbers. |
| 53 | + |
| 54 | +- [ExclusiveMaximumValidator](src/Component/Numeric/ExclusiveMaximumValidator.php) |
| 55 | +- [ExclusiveMinimumValidator](src/Component/Numeric/ExclusiveMinimumValidator.php) |
| 56 | +- [MaximumValidator](src/Component/Numeric/MaximumValidator.php) |
| 57 | +- [MinimumValidator](src/Component/Numeric/MinimumValidator.php) |
| 58 | +- [MultipleOfValidator](src/Component/Numeric/MultipleOfValidator.php) |
| 59 | + |
| 60 | +### Object |
| 61 | + |
| 62 | +Object validators verify the contents of objects. |
| 63 | + |
| 64 | +- [DependencyValidator](src/Component/Object/DependencyValidator.php) |
| 65 | +- [MaxPropertiesValidator](src/Component/Object/MaxPropertiesValidator.php) |
| 66 | +- [MinPropertiesValidator](src/Component/Object/MinPropertiesValidator.php) |
| 67 | +- [PropertiesValidator](src/Component/Object/PropertiesValidator.php) |
| 68 | +- [RequiredValidator](src/Component/Object/RequiredValidator.php) |
| 69 | + |
| 70 | +### Textual |
| 71 | + |
| 72 | +Textual validators work with strings. |
| 73 | + |
| 74 | +- [MaxLengthValidator](src/Component/Textual/MaxLengthValidator.php) |
| 75 | +- [MinLengthValidator](src/Component/Textual/MinLengthValidator.php) |
| 76 | +- [PatternValidator](src/Component/Textual/PatternValidator.php) |
| 77 | + |
| 78 | +### Type |
| 79 | + |
| 80 | +Type validators verify the type of the data. For example: whether the supplied |
| 81 | +data is of the type string, or integer. |
| 82 | + |
| 83 | +- [ArrayValidator](src/Component/Type/ArrayValidator.php) |
| 84 | +- [BooleanValidator](src/Component/Type/BooleanValidator.php) |
| 85 | +- [IntegerValidator](src/Component/Type/IntegerValidator.php) |
| 86 | +- [NullValidator](src/Component/Type/NullValidator.php) |
| 87 | +- [NumberValidator](src/Component/Type/NumberValidator.php) |
| 88 | +- [ObjectValidator](src/Component/Type/ObjectValidator.php) |
| 89 | +- [StringValidator](src/Component/Type/StringValidator.php) |
| 90 | + |
| 91 | +## Change log |
| 92 | + |
| 93 | +Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently. |
| 94 | + |
| 95 | +## Contributing |
| 96 | + |
| 97 | +Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details. |
| 98 | + |
| 99 | +## MIT License |
| 100 | + |
| 101 | +Copyright (c) 2019 Jyxon |
| 102 | + |
| 103 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 104 | +of this software and associated documentation files (the "Software"), to deal |
| 105 | +in the Software without restriction, including without limitation the rights |
| 106 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 107 | +copies of the Software, and to permit persons to whom the Software is |
| 108 | +furnished to do so, subject to the following conditions: |
| 109 | + |
| 110 | +The above copyright notice and this permission notice shall be included in all |
| 111 | +copies or substantial portions of the Software. |
| 112 | + |
| 113 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 114 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 115 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 116 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 117 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 118 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 119 | +SOFTWARE. |
0 commit comments