2017 © Pedro Peláez
 

library slack-notifier-bundle

A simple wrapper for Slack notifications

image

t1l3/slack-notifier-bundle

A simple wrapper for Slack notifications

  • Friday, May 23, 2014
  • by T1l3
  • Repository
  • 1 Watchers
  • 2 Stars
  • 392 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

T1l3SlackNotifierBundle

A simple wrapper for polem/slack-notifier to send Slack notifications., (*1)

Installation

Download T1l3SlackNotifier using composer

Add T1l3SlackNotifier in your composer.json:, (*2)

{
    "require": {
        "t1l3/slack-notifier-bundle": "0.1"
    }
}

Now tell composer to download the bundle by running the command:, (*3)

$ php composer.phar update t1l3/slack-notifier-bundle

Enable the bundle

Enable the bundle in the kernel:, (*4)

<?php
// app/AppKernel.php

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

Configure T1l3SlackNotifier

First you need to create an [incoming-webhook][3] in Slack to get your token. You can also set default Bot name and icon in the Integration Settings part., (*5)

Then add it to your config.yml, (*6)

# app/config/config.yml
t1l3_slack_notifier:
    team: yourteam
    token: yOurT0ken

Usage

You just have to call t1l3_slack_notifier service and add a Slack\Message\Message to the notify method., (*7)

Here is a simple exemple of using it in a controller., (*8)

<?php

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);

        // ...
    }
}

The Versions

23/05 2014

dev-master

9999999-dev

A simple wrapper for Slack notifications

  Sources   Download

MIT

The Requires

 

by Thibault PIERRE

slack

22/05 2014

0.1

0.1.0.0

A simple wrapper for Slack notifications

  Sources   Download

MIT

The Requires

 

by Thibault PIERRE

slack