1. Go to this page and download the library: Download yupmin/laravel-phystrix 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/ */
yupmin / laravel-phystrix example snippets
class TestCommand extends AbstractCommand
{
protected $wantFallback;
public function __construct($wantFallback = false)
{
$this->wantFallback = $wantFallback;
}
/**
* @param bool $wantFallback
* @return mixed
* @throws Exception
*/
protected function run()
{
if ($this->wantFallback) {
throw new Exception("fallback");
}
return 'run test';
}
/**
* @param Exception|null $exception
* @return mixed
*/
protected function getFallback(?Exception $exception = null)
{
return $exception->getMessage();
}
}