PHP code example of clue / wol-react

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

    

clue / wol-react example snippets


$loop = React\EventLoop\Factory::create();
$wolFactory = new Clue\React\Wol\Factory($loop);

$wolFactory->createSender()->then(function(Clue\React\Wol\Sender $wol) {
    $wol->send('11:22:33:44:55:66');
});

$loop->run();

$loop = React\EventLoop\Factory::create();
$wolFactory = new Clue\React\Wol\Factory($loop);

$wolFactory->createSender('1.2.3.4:9')->then(function(Clue\React\Wol\Sender $wol) {
    $wol->send('11:22:33:44:55:66');
});

$loop->run();
bash
$ php bin/wol.php 11:22:33:44:55:66