Code Monkey home page Code Monkey logo

phpwakeonlan's Introduction

PHPWakeOnLan

Travis Build Status StyleCI Status Codecov Status Latest Version on Packagist

Wake on lan target enabled devices by sending magic packets to them from PHP.

Installation

Require the package using composer:

composer require diegonz/php-wake-on-lan

Usage:

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
        )
)

Laravel package config

You can publish laravel package configuration file running the command below:

php artisan vendor:publish --provider="Diegonz\PHPWakeOnLan\PHPWakeOnLanServiceProvider" --tag="config"

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

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.

External links

Magic Packet Technology -

White paper describing the specification and implementation of Magic Packet™ technology from AMD, one of its two co-developers.

Credits

License

The MIT License (MIT). Please see license file for more information.

phpwakeonlan's People

Contributors

diegonz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.