强制/演说家

Coercive Orator

0.0.7 2024-07-18 10:21 UTC

This package is auto-updated.

Last update: 2024-09-18 10:43:59 UTC


README

用于 Slack 和 Discord webhooks 的简单处理程序。

获取

composer require coercive/orator

Slack

$slack = new SlackHook(HOOKS_SLACK_URL);
$slack->publish('Hello!');

Discord

$discord = new DiscordHook(HOOKS_DISCORD_URL);
$discord->setContent('Hello!');
$discord->publish();

语音化文本?

$discord->setTts(true);

高级嵌入内容

# Simple content
$embed1 = new Embed('Light', 'This is white colored', '#FFFFFF');

# Complex content
$embed2 = new Embed;
$embed2->Author()->setName('JOHN DOE');
$embed2->setTitle('Custom title');
$embed2->setColor('#FF0000');
$embed2->setDescription('Say something');
$embed2->Footer()->setText('This is the end');

$discord = new DiscordHook(HOOKS_DISCORD_URL);
$discord->setContent('Hello!');
$discord->addEmbed($embed1);
$discord->addEmbed($embed2);
$discord->publish();

日志

基本配置示例

L::detectLogpath();
L::basepath('/root/path/to/my/project');
L::header('prod', 'myproject', 'coercive', '•••');
L::colorizeLevel();

然后,你可以记录一些内容

# Log by level (debug, error, fatal, info, warning)
L::info('Hello! This is an info log!');
L::warning('Hello! This is a warning log!');

# Log mixed data
L::debug([
    'example',
    'data',
    'to',
    'log'
]);

# Add separator
L::separator();
L::rainbow();