PHP code example of mjohann / call-morph
1. Go to this page and download the library: Download mjohann/call-morph 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/ */
mjohann / call-morph example snippets
use MJohann\Packlib\CallMorph;
() use ($name) {
sleep(1);
return "My name is " . $name . " - Rand: " . rand(0, 999);
};
$cm = new CallMorph("secret");
$serialized = $cm->serialize($closure);
echo "CallMorph->serialize", PHP_EOL;
var_dump($serialized);
echo PHP_EOL, PHP_EOL;
echo "CallMorph->unserialize", PHP_EOL;
$closure = $cm->unserialize($serialized);
echo $closure();
call-morph/
├── src/
│ └── CallMorph.php
│ └── Facades/
│ └── CallMorph.php
├── example/
│ └── script.php
├── composer.json
├── .gitignore
├── LICENSE
└── README.md