PHP code example of sms77 / monolog

1. Go to this page and download the library: Download sms77/monolog library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sms77 / monolog example snippets


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

$apiKey = getenv('SEVEN_API_KEY');
$logger = new Logger('demo');

// Forward WARNING-and-above entries as SMS
$cfg = new Config([
    'apiKey'     => $apiKey,
    'from'       => 'Logger',
    'recipients' => '+491234567890',
]);

$logger->pushHandler(new Handler($cfg, Logger::WARNING));
$logger->warning('Something is wrong!');