PHP code example of jmrashed / laravel-slack-notifier
1. Go to this page and download the library: Download jmrashed/laravel-slack-notifier 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/ */
jmrashed / laravel-slack-notifier example snippets
use Jmrashed\SlackNotifier\Facades\SlackNotifier;
SlackNotifier::send('Test message');
public function register(): void
{
$this->reportable(function (Throwable $e) {
\Jmrashed\SlackNotifier\Facades\SlackNotifier::send($e);
});
}
public function report(Throwable $exception)
{
if ($this->shouldReport($exception)) {
\Jmrashed\SlackNotifier\Facades\SlackNotifier::send($exception);
}
parent::report($exception);
}
public function report(Exception $exception)
{
if ($this->shouldReport($exception)) {
\Jmrashed\SlackNotifier\Facades\SlackNotifier::send($exception);
}
parent::report($exception);
}
use Jmrashed\SlackNotifier\Facades\SlackNotifier;
$variable = 'message'; // or $variable = ['key' => 'value'];
SlackNotifier::send($variable);