tomnomnom/phpwol
Composer 安装命令:
composer require tomnomnom/phpwol
包简介
Wake On LAN for PHP
README 文档
README
Send Wake On LAN packets with PHP.
Contents
Installation
Phpwol is available on Packagist so you can
install it using Composer. Just specify it as a dependency in your
composer.json:
{
"require": {
"tomnomnom/phpwol": "0.1.0"
}
}
Then run composer install:
▶ composer install
Loading composer repositories with package information
Installing dependencies
- Installing tomnomnom/phpwol (0.1.0)
Downloading: 100%
Writing lock file
Generating autoload files
Once installed you can use the Composer autoloader instead of the one provided in ./Phpwol/Init.php:
<?php require __DIR__.'/vendor/autoload.php'; $f = new \Phpwol\Factory(); $m = $f->magicPacket();
Usage
A \Phpwol\MagicPacket object is used to send a WOL packet. Such an object is availble via the \Phpwol\Factory::magicPacket() method.
<?php // ./Examples/Basic.php require __DIR__.'/../Phpwol/Init.php'; $f = new \Phpwol\Factory(); $magicPacket = $f->magicPacket(); $macAddress = '50:46:5C:53:94:25'; $broadcastIP = '192.168.1.255'; $result = $magicPacket->send($macAddress, $broadcastIP); if ($result){ echo "Worked\n"; } else { echo "Failed\n"; }
▶ php ./Examples/Basic.php
Worked
If you don't know what the broadcast IP is and don't know how to work it out, you can just specify the IP and subnet mask and everything will be worked out for you.
<?php // ./Examples/UnknownBroadcast.php require __DIR__.'/../Phpwol/Init.php'; $f = new \Phpwol\Factory(); $magicPacket = $f->magicPacket(); $macAddress = '50:46:5C:53:94:25'; $ip = '192.168.1.10'; $subnet = '255.255.255.0'; $result = $magicPacket->send($macAddress, $ip, $subnet); if ($result){ echo "Worked\n"; } else { echo "Failed\n"; }
▶ php ./Examples/UnknownBroadcast.php
Worked
Requirements
- Linux of some description
- PHP 5.3 or newer
Testing
You can run the tests by running:
▶ phpunit
The repo is hooked up to Travis CI. You can see the state of the master branch and the build history on the Phpwol Travis CI page. The full test suite runs under PHP 5.3 and PHP 5.4.
tomnomnom/phpwol 适用场景与选型建议
tomnomnom/phpwol 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.77k 次下载、GitHub Stars 达 11, 最近一次更新时间为 2013 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tomnomnom/phpwol 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tomnomnom/phpwol 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-18