1. Go to this page and download the library: Download ulrack/fallback library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ulrack / fallback example snippets
use Ulrack\Fallback\Component\Fallback;
use Ulrack\Validator\Component\Logical\ConstValidator;
$class = new class {
/**
* Returns the input.
*
* @param string $input
*
* @return string
*/
public function foo(string $input): string
{
return $input;
}
};
$validator = new ConstValidator('bar');
$fallback = new Fallback([$class, 'foo'], $validator);
use Ulrack\Fallback\Component\FallbackStack;
use Ulrack\Validator\Component\Type\StringValidator;
$validator = new StringValidator();
$fallbackStack = new FallbackStack($validator);
$fallbackStack->addFallback($fallback, 0);
$fallbackStack('bar');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.