tfarla / want-type
A simple validation utility for php
This package's canonical repository appears to be gone and the package has been frozen as a result.
dev-master
2014-08-04 08:51 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 3.7.3
This package is auto-updated.
Last update: 2020-10-16 12:27:07 UTC
README
A simple php type utility
Installation
composer require tfarla/want-type dev-master
Usage
// Returns null
Want\string('s');
Want\string('s', 't', 'r', 'i', 'n', 'g');
// Throws InvalidArgumentException
Want\string(true);
// Returns null
Want\collectionOf('string', array('s'))
Want\collectionOf('string', array('s'), array('t'))
// Throws InvalidArgumentException
Want\collectionOf('string', array(1))
##Functions
\Want\bool(...)
\Want\collection(...)
\Want\collectionOf(type, ...)
\Want\double(...)
\Want\float(...)
\Want\instance('class', ...)
\Want\int(...)
\Want\invokable(...)
\Want\null(...)
\Want\numeric(...)
\Want\object(...)
\Want\resource(...)
\Want\scalar(...)
\Want\string(...)