kicken/sleep-blocker
最新稳定版本:v0.2.0
Composer 安装命令:
composer require kicken/sleep-blocker
包简介
Allows a PHP script to prevent the system from going to sleep
README 文档
README
Allow PHP scripts to prevent a system from going to sleep.
Example
Obtain a blocker by calling SleepBlocker::create. This will return a blocker implementation appropriate for the current system.
$blocker = Kicken\SleepBlocker\SleepBlocker::create();
Use the blocker methods preventSleep and allowSleep to disable or enable the system's ability to enter sleep mode.
$server = stream_socket_server('tcp://0.0.0.0:9');
while (true){
$client = stream_socket_accept($server, null);
if ($client){
$blocker->preventSleep();
do {
$data = fread($client, 1024);
if (!$data){
fclose($client);
$client = null;
}
} while ($client);
$blocker->sllowSleep();
}
}
Known issues
Currently only Microsoft Windows systems are supported.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-29