bitandblack / cli-notification
从CLI发送通知声音和弹出窗口
1.0.0
2022-11-21 20:12 UTC
Requires
- php: >=7.4
- jolicode/jolinotif: ^2.0
- myclabs/php-enum: ^1.0
Requires (Dev)
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.5
- rector/rector: ^0
- symplify/easy-coding-standard: ^11.0
This package is auto-updated.
Last update: 2024-09-22 00:26:48 UTC
README
CLI通知
从CLI发送通知声音和弹出窗口。
安装
这个库是为与Composer一起使用而制作的。通过运行$ composer require bitandblack/cli-notification
将其添加到您的项目中。
用法
声音
每当您想播放声音时,请调用Sound::play()
方法。它需要一个参数——您想要播放的声音。您可以使用包含一些基本声音的SoundFileEnum,或者通过实现SoundFileInterface提供您自己的包含自定义声音的类。
play()
方法是静态的,因此您不需要初始化该类。
<?php
use BitAndBlack\CLINotification\Sound;
use BitAndBlack\CLINotification\SoundFile\SoundFileEnum;
Sound::play(
SoundFileEnum::JOB_DONE()
);
弹出窗口
每当您想显示弹出窗口时,请调用Popup::show()
方法。您可以在那里设置标题、消息和图片。
show()
方法是静态的,因此您不需要初始化该类。
<?php
use BitAndBlack\CLINotification\Popup;
Popup::show(
'Title',
'Message',
'/path/to/image.jpg'
);
帮助
如果您有任何问题,请随时通过hello@bitandblack.com
联系我们。
有关Bit&Black的更多信息,请访问www.bitandblack.com。