PHP code example of gos / yolo

1. Go to this page and download the library: Download gos/yolo 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/ */

    

gos / yolo example snippets


$pusher->push($notification); #send notification over network

use Gos\Component\Yolo\Yolo;

$maxRetry = 10; // Default is 5
$timeout = 10; // Default is 5 (in second), set 0 for not timeout
$allowedException = ['RuntimeException']; // empty by default, consider exception as a "success"
$yoloPush = new Yolo(array($pusher, 'push'), array($notification), $maxRetry, $timeout);
$yoloPush->run();

use Gos\Component\Yolo\Yolo;

$yoloPush = new Yolo(array($pusher, 'push'), array($notification));
$yoloPush->tryUntil(function(){
    $result = false;
    if ($fp = @fsockopen('my-web-service.dev', 1337, $errCode, $errStr, 1)) {
        $result = true;
        fclose($fp);
    }

    return $result;
});

use Gos\Component\Yolo\Yolo;

$yoloPush = new Yolo(array($pusher, 'push'), array($notification));
$yoloPush->tryUntil($pusher);

use Gos\Component\Yolo\Yolo;

$yolo = new Yolo(function(){});
$yolo->setLogger($mySwagPsrLogger);

use Gos\Component\Yolo\Yolo;
use Gos\Component\Yolo\Callback\PingBack;

$pingger = new PingBack('127.0.0.1', 80);

$yoloPush = new Yolo(function(){});
$yoloPush->tryUntil($pingger);