PHPackages                             yoshi2889/validation-closures - 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. yoshi2889/validation-closures

AbandonedArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

yoshi2889/validation-closures
=============================

Closures useful for validating data. Provides type validation amongst other filters.

v0.2(8y ago)12.7k1[1 issues](https://github.com/Yoshi2889/validation-closures/issues)1MITPHPPHP &gt;=7.1.0

Since Jun 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Yoshi2889/validation-closures)[ Packagist](https://packagist.org/packages/yoshi2889/validation-closures)[ RSS](/packages/yoshi2889-validation-closures/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (1)

Validation Closures
===================

[](#validation-closures)

[![Build Status](https://camo.githubusercontent.com/36969fe55c67cd13fb339868a452808a1f81251e69b56db84b74b8369b1c9b7d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f596f736869323838392f76616c69646174696f6e2d636c6f73757265732f6261646765732f6275696c642e706e67)](https://scrutinizer-ci.com/g/Yoshi2889/validation-closures/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1feeba7fecc204b3d7d3d5908ed12a54846dd849aaa1bd2d0acefa97ac80c225/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f596f736869323838392f76616c69646174696f6e2d636c6f73757265732f6261646765732f7175616c6974792d73636f72652e706e67)](https://scrutinizer-ci.com/g/Yoshi2889/validation-closures/?branch=master)[![Scrutinizer Code Coverage](https://camo.githubusercontent.com/a5bf747ee1543adf54b3d8b77b71aaa10db71bfffa56fcf18fb1ac9cc1e8ade7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f596f736869323838392f76616c69646174696f6e2d636c6f73757265732f6261646765732f636f7665726167652e706e67)](https://scrutinizer-ci.com/g/Yoshi2889/validation-closures/code-structure/master/code-coverage)[![Latest Stable Version](https://camo.githubusercontent.com/bbdf02ef436cbfec21357d6038f9c20ae92349ad869005dd0b0000760e0c18b7/68747470733a2f2f706f7365722e707567782e6f72672f796f736869323838392f76616c69646174696f6e2d636c6f73757265732f762f737461626c65)](https://packagist.org/packages/yoshi2889/validation-closures)[![Latest Unstable Version](https://camo.githubusercontent.com/c27aeb6bff521ddf090401ba56b476c445a7a029c2d1ffcd29d348b438682bfb/68747470733a2f2f706f7365722e707567782e6f72672f796f736869323838392f76616c69646174696f6e2d636c6f73757265732f762f756e737461626c65)](https://packagist.org/packages/yoshi2889/validation-closures)[![Total Downloads](https://camo.githubusercontent.com/26c3fc4d8a579617b0b227a0bca32f366626b3c43e68d66fbcb1643cf5de7cd4/68747470733a2f2f706f7365722e707567782e6f72672f796f736869323838392f76616c69646174696f6e2d636c6f73757265732f646f776e6c6f616473)](https://packagist.org/packages/yoshi2889/validation-closures)

Closures useful for validating data. Provides type validation amongst other filters.

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

[](#installation)

You can install this class via `composer`:

`composer require yoshi2889/validation-closures`

Usage
-----

[](#usage)

All closures are exposed as public static methods. For example, to use the Types\\string() closure:

```
$closure = \ValidationClosures\Types::string();

$is_string = $closure('This is a string');

// True
echo $is_string ? 'True' : 'False';
```

In the following documentation, all methods return a value of type `boolean` unless stated otherwise.

### Ranges

[](#ranges)

The Ranges class contains methods to check if values are within a range. It contains the following methods:

- `stringWithLengthBetween(int $minimumLength, int $maximumLength)`: Test if a given string has a length within the range `$minimumLength
