1. Go to this page and download the library: Download decodelabs/fluidity 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/ */
decodelabs / fluidity example snippets
namespace DecodeLabs\Fluidity;
interface Then
{
public function then(callable $callback): Then;
public function thenEach(iterable $values, callable $callback): Then;
public function thenIf(?bool $truth, callable $yes, callable $no=null): Then;
public function thenUnless(?bool $truth, callable $no, callable $yes=null): Then;
}
use DecodeLabs\Fluidity\Then;
use DecodeLabs\Fluidity\ThenTrait;
$test = new class() implements Then {
use ThenTrait;
public function doThing(int $value=null) {}
};
$truth = true;
$test
->then(function($test) {
$test->doThing();
})
->thenEach([1, 2, 3], function($test, $value) {
// Called three times
$test->doThing($value);
})
->thenIf($truth, function($test) {
// This gets called if($truth)
}, function($test) {
// This get called otherwise
})
->thenUnless($truth, function($test) {
// This gets called if(!$truth)
}, function($test) {
// This get called otherwise
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.