PHP code example of mwakaambrose / laravel-slack-alert
1. Go to this page and download the library: Download mwakaambrose/laravel-slack-alert 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/ */
mwakaambrose / laravel-slack-alert example snippets
use MwakaAmbrose\SlackAlert\Facades\SlackAlert;
SlackAlert::string("You have a new subscriber to the {$newsletter->name} newsletter!");
return [
/*
* The webhook URLs that we'll use to send a message to Slack.
*/
'webhook_urls' => [
'default' => env('SLACK_ALERT_WEBHOOK'),
],
];
SlackAlert::string("You have a new subscriber to the {$newsletter->name} newsletter!");
use MwakaAmbrose\SlackAlert\Facades\SlackAlert;
SlackAlert::to('marketing')->string("You have a new subscriber to the {$newsletter->name} newsletter!");
use MwakaAmbrose\SlackAlert\Facades\SlackAlert;
SlackAlert::to('https://custom-url.com')->message("You have a new subscriber to the {$newsletter->name} newsletter!");
use MwakaAmbrose\SlackAlert\Facades\SlackAlert;
SlackAlert::string("A message *with some bold statements* and _some italicized text_.");
SlackAlert::string("<https://theonehq.com|This is a link to our homepage>");
use MwakaAmbrose\SlackAlert\Facades\SlackAlert;
SlackAlert::string(":smile: :custom-code:");
use MwakaAmbrose\SlackAlert\Facades\SlackAlert;
SlackAlert::string("A message that notifies <@username> and everyone else who is <!here>")
SlackAlert::to("failed_vsla_wallet")->exception(new \Exception("This is a test exception"));
SlackAlert::to('failed_vsla_wallet')->send(function(){
$msg = Message::new();
// Then you can add blocks using the surface's available methods.
$msg->text('Don\'t you just love Slack?');
$msg->divider();
$msg->newImage()
->title('Team Chat')
->url('https://imgs.xkcd.com/comics/team_chat.png')
->altText('Comic about the stubbornness of some people switching chat clients');
return $msg;
});