1. Go to this page and download the library: Download fabiomsouto/phuse 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/ */
class AFuseObserver implements SplObserver {
public function update(SplSubject $subject)
{
$blown = $subject->blown();
echo "This fuse is now ";
echo $blown? "blown\n" : "not blown\n";
}
}
...
$M = 10;
$T = 100;
$R = 1000;
$fuse = FuseBox::getUnsafeApcInstance("database", $M, $T, $R);
$observer = new AFuseObserver();
$fuse->attach($observer);
// when the fuse melts you will see something in your terminal
$fuse->melt();
// outputs "This fuse is now blown" when the threshold is reached
...
// after 1000ms...
$fuse->ok();
// outputs "This fuse is now not blown" when the restart period ends
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.