Sucre/Assertion is simple loosely-coupled assertion PHP library.
- PHP 5.4 or later
Download the composer.phar
.
$ curl -s http://getcomposer.org/installer | php
Run Composer: php composer.phar require "cyrill/sucre-assertion"
<?php
reqire __DIR__.'/composer/autoload.php';
use Sucre\Assertion;
// Assertion::disable(); // if you disable Sucre\Assertion (ie. production)
try {
Assertion::factory()
->mustString($string)
->mustNull(null)
->assert();
} catch (Exception $e) {
// If passed values is not fulfilled. "assert" methods throw Sucre\Assertion\CompositeAssertionException
// $e->getFirstException();
// $e->getLastException();
// $e->getExceptions();
echo $e;
}
Sucre\Assertion is tested by PHPUnit.
Run composer composer install --dev
.
All you have to do is to run phpunit
.
The MIT License