Wake on lan target enabled devices by sending magic packets to them from PHP.
Require the package using composer:
composer require diegonz/php-wake-on-lan
Normal PHP usage:
<?php
use \Diegonz\PHPWakeOnLan\PHPWakeOnLan;
$macAddresses = [
'00:1B:2C:1C:DF:22',
'01:1C:2C:1C:DF:13',
];
try {
$wol = new PHPWakeOnLan();
print_r($wol->wake($macAddresses));
} catch (Exception $e) {
var_dump($e->getMessage());
}
Laravel facade usage:
<?php
use \Diegonz\PHPWakeOnLan\Facades\PHPWakeOnLan;
$macAddresses = [
'00:1B:2C:1C:DF:22',
'01:1C:2C:1C:DF:13',
];
try {
print_r(PHPWakeOnLan::wake($macAddresses));
} catch (Exception $e) {
var_dump($e->getMessage());
}
Example output:
Array
(
[00:1B:2C:1C:DF:22] => Array
(
[result] => OK
[message] => Magic packet sent to 00:1B:2C:1C:DF:22 through 255.255.255.255
[bytes_sent] => 102
)
[01:1C:2C:1C:DF:13] => Array
(
[result] => OK
[message] => Magic packet sent to 01:1C:2C:1C:DF:13 through 255.255.255.255
[bytes_sent] => 102
)
)
You can publish laravel package configuration file running the command below:
php artisan vendor:publish --provider="Diegonz\PHPWakeOnLan\PHPWakeOnLanServiceProvider" --tag="config"
composer test
Please see CHANGELOG for more information what has changed recently.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
White paper describing the specification and implementation of Magic Packet™ technology from AMD, one of its two co-developers.
The MIT License (MIT). Please see license file for more information.