sms77/monolog

This package is abandoned and no longer maintained. The author suggests using the seven.io/monolog package instead.

A Monolog Handler for sending SMS via seven

0.1.0 2022-03-17 04:54 UTC

This package is auto-updated.

Last update: 2023-12-15 13:14:59 UTC


README

68747470733a2f2f7777772e736576656e2e696f2f77702d636f6e74656e742f75706c6f6164732f4c6f676f2e737667

Monolog Handler

Send log entries by SMS or make text-to-speech calls via seven.

Installation

This package can be installed via composer.

composer require seven.io/monolog

Usage

use Seven\Monolog\Config;
use Seven\Monolog\Handler;
use Monolog\Logger;

$logger = Logger('demo');
$apiKey = getenv('SEVEN_API_KEY'); // seven API key required for sending

// SMS
$cfg = [
    Config::KEY_API_KEY => $apiKey,
    Config::KEY_FLASH => 0, // 0 or 1
    Config::KEY_FOREIGN_ID => 'MyForeignID', // optional foreign ID max 64 chars consisting of a-zA-Z0-9, ._@
    Config::KEY_FROM => 'Monolog', // optional sender - max 11 alphanumeric or 16 numeric characters
    Config::KEY_JSON => 0, // 0 or 1
    Config::KEY_LABEL => 'MyLabel', // optional label max 100 chars consisting of a-zA-Z0-9, ._@
    Config::KEY_NO_RELOAD => 0, // 0 or 1
    Config::KEY_PERFORMANCE_TRACKING => 0, // 0 or 1
    Config::KEY_TO => '+491234567890', // recipient(s) separated by comma
];
$handler = Handler::buildFromArray($cfg);
$logger
    ->pushHandler($handler)
    ->addCritical('critical bug');

// text-to-speech call
$cfg = [
    Config::KEY_API_KEY => $apiKey,
    Config::KEY_APP => Config::APP_VOICE,
    Config::KEY_FROM => '+4901234567890', // optional sender - must be verified or a shared inbound number
    Config::KEY_JSON => 0, // 0 or 1
    Config::KEY_TO => '+491234567890', // recipient(s) separated by comma
];
$handler = Handler::buildFromArray($cfg);
$logger
    ->pushHandler($handler)
    ->addCritical('critical bug');

Support

Need help? Feel free to contact us.

MIT