PHP code example of t1l3 / slack-notifier-bundle

1. Go to this page and download the library: Download t1l3/slack-notifier-bundle 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/ */

    

t1l3 / slack-notifier-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new T1l3\SlackNotifierBundle\T1l3SlackNotifierBundle(),
    );
}



namespace Acme\DemoBundle\Controller;

// ...
use Slack\Message\Message;

class DefaultController extends Controller
{
    public function indexAction()
    {
        $message = new Message('Hello World!');
        $message->setChannel('#your-chanel')
        ->setIconEmoji(':princess:')
        ->setUsername('Bot')
        ;

        $slackNotifier = $this->get('t1l3_slack_notifier');
        $slackNotifier->notify($message);

        // ...
    }
}