1. Go to this page and download the library: Download reasno/compose-mixins 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/ */
reasno / compose-mixins example snippets
use function Reasno\Helpers\composeMixins;
use Reasno\Helpers\Recipe;
$c = composeMixins(new Recipe('pipe'), /* callable */ $a, /* callable */ $b);
$result = $c($input); //Use the composed function
function composeMixins(Recipe $recipe, callable ...$mixins)
new Recipe('map');
/* use a different handler each time the composed function is called */
$r = Recipe::fromCallable(function(...$fns){
static $i = 0;
return function($input) use (&$i, $fns){
try{
return $fns[$i++]($input);
} catch( Error $e ){
return null;
}
};
});
Class MyRecipeHandler{
//...
}
$CustomRecipe = new Recipe('fancy', ['handler' => 'MyRecipeHandler']);
tests/composeMixinsTest.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.