ahmard/clock
Composer 安装命令:
composer require ahmard/clock
包简介
PHP Clock written on top of ReactPHP
README 文档
README
A clock description here...
Installation
composer require ahmard/clock
Usage
- Seconds
use Clock\Clock; Clock::after(1, function (){ echo 'Executed'; }); Clock::forEachSecond(function (){ echo "1 second has passed\n"; }); Clock::forEachSecond(5, function (){ echo "5 seconds has passed\n"; });
- Minutes
use Clock\Clock; Clock::after('1 minute', function (){ echo 'Executed'; }); Clock::forEachMinute(2, function (){ echo "2 minutes has passed\n"; });
- Hours
use Clock\Clock; Clock::after('1 hour', function (){ echo 'Executed'; }); Clock::forEachHour(1, function (){ echo "1 hour has passed\n"; });
Advance usage
use Clock\Clock; use React\EventLoop\TimerInterface; Clock::forEach('1 minute 5 seconds', function (){ echo "1 minute 5 seconds has passed\n"; }); Clock::forEach('2 minutes', function (TimerInterface $timer){ echo "2 minutes has passed\n"; Clock::stop($timer); });
Sound
This library comes with sounds out of the box
To use them, you will need to install Sox
use Clock\Clock;use Clock\Sound; Sound::play(__DIR__ . '/test.mp3'); Clock::forEachMinute(function (){ Sound::playAlarm(); });
Notification
Push notification to your system
use Clock\Clock; use Clock\Notification; $notification = Notification::create() ->setTitle('My Title') ->setIcon('/drive/path/to/icon.jpg'); $notification ->setBody('My notification body here') ->send(); Clock::forEach('2 minutes', function () use ($notification){ $notification->setBody('Two minutes has passed'); $notification->send(); });
ahmard/clock 适用场景与选型建议
ahmard/clock 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 706 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「clock」 「php clock」 「reactphp clock」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ahmard/clock 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ahmard/clock 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ahmard/clock 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple, event-driven multicast UDP message client and server for ReactPHP.
Time provider, providing consistent current date, time, datetime and timezone across the request.
The smallest PSR-20 implementation (PHP 7.0 and later)
PSR-20 Implementation
A Laravel Nova card.
Fundamental contracts and shared abstractions for Maatify modules, including clock and telemetry interfaces.
统计信息
- 总下载量: 706
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-05