coercive/orator

Coercive Orator

0.0.7 2024-07-18 10:21 UTC

This package is auto-updated.

Last update: 2024-10-18 10:51:28 UTC


README

Simple handlers for Slack and Discord webhooks.

Get

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();

Vocalize text ?

$discord->setTts(true);

Advanced embed content

# 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();

Log

Example of basic config

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

And then, you can log something

# 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();