PHP code example of supercid / php-wake-on-lan

1. Go to this page and download the library: Download supercid/php-wake-on-lan 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/ */

    

supercid / php-wake-on-lan example snippets




use \SuperCid\PHPWakeOnLan\PHPWakeOnLan;

$macAddress = '00:1B:2C:1C:DF:22';
$ipAddress = '192.168.0.1';

try {
    $wol = new PHPWakeOnLan();
    print_r($wol->wake($macAddress, $ipAddress));
} catch (Exception $e) {
    var_dump($e->getMessage());
}



use \SuperCid\PHPWakeOnLan\Facades\PHPWakeOnLan;

$macAddress = '00:1B:2C:1C:DF:22';
$ipAddress = '192.168.0.1';

try {
    print_r(PHPWakeOnLan::wake($macAddress, $ipAddress));
} catch (Exception $e) {
    var_dump($e->getMessage());
}
bash
php artisan vendor:publish --provider="SuperCid\PHPWakeOnLan\PHPWakeOnLanServiceProvider" --tag="config"