PHP code example of mckayb / phantasy
1. Go to this page and download the library: Download mckayb/phantasy 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/ */
mckayb / phantasy example snippets
use Phantasy\DataTypes\Maybe\Maybe;
use function Phantasy\Core\prop;
$user = [ "name" => "Foo", "email" => "[email protected]" ];
$name = Maybe::of($user)
->map(prop('name'))
->getOrElse(null);
// "Foo"