villfa / tryagain
The TryAgain library permits to call a function again if the result is wrong.
Requires
- php: >=5.3.3
Requires (Dev)
- mockery/mockery: >=0.8.0
This package is auto-updated.
Last update: 2020-11-01 19:33:00 UTC
README
TryAgain is a very light PHP library which permits to call a function again when the result is not satisfying.
The main advantage is that it permits to avoid code duplication by creating reusable validators.
Server Requirements
- PHP version 7.0 or newer
Installation
TryAgain may be installed using Composer. You can read more about Composer and its main repository at http://packagist.org. To install TryAgain using Composer, first install Composer for your project using the instructions on the Packagist home page. You can then define your development dependency on TryAgain using the suggested parameters below.
{
"require": {
"villfa/TryAgain": ">=1.0.0"
}
}
To install, you then may call:
$ composer.phar install
Tests
To run the test suite, you need composer and PHPUnit.
$ cd path/to/TryAgain
$ composer.phar install --dev
$ ./vendor/bin/phpunit
Example
Here a minimalist example:
<?php require 'vendor/autoload.php'; $handler = new \TryAgain\Handler; $handler->execute('printf', 'Hello world');
More detailed examples are available in the examples directory.