2017 © Pedro Peláez
 

symfony-bundle slack-bundle

Symfony bundle integration of nexylan/slack library

image

nexylan/slack-bundle

Symfony bundle integration of nexylan/slack library

  • Thursday, January 18, 2018
  • by Soullivaneuh
  • Repository
  • 6 Watchers
  • 36 Stars
  • 86,244 Installations
  • PHP
  • 0 Dependents
  • 8 Suggesters
  • 5 Forks
  • 4 Open issues
  • 11 Versions
  • 17 % Grown

The README.md

NexySlackBundle

Symfony bundle integration of the nexylan/slack library (old popular maknz/slack)., (*1)

Latest Stable Version Latest Unstable Version License Dependency Status Reference Status, (*2)

Total Downloads Monthly Downloads Daily Downloads, (*3)

Build Status Scrutinizer Code Quality Code Climate Coverage Status SensioLabsInsight, (*4)

Documentation

All the installation and usage instructions are located in this README. Check it for specific version:, (*5)

  • 1.x with support for Symfony >=2.7
  • 2.x with support for Symfony >=3.4

Prerequisites

This version of the project requires:, (*6)

  • PHP 7.1+
  • Symfony 3.4+

Installation

First of all, you need to require this library through composer:, (*7)

``` bash $ composer require nexylan/slack-bundle php-http/guzzle6-adapter, (*8)


Why `php-http/guzzle6-adapter`? We are decoupled from any HTTP messaging client thanks to [HTTPlug](http://httplug.io/). Then, enable the bundle on the `AppKernel` class: ``` php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Http\HttplugBundle\HttplugBundle(), new Nexy\SlackBundle\NexySlackBundle(), ); // ... return $bundles }

Configuration

If it is not already done, you have to configure httplug-bundle first. Check the official documentation for this., (*9)

Configure the bundle to your needs (example with default values):, (*10)

nexy_slack:

    # If you want to use an another httplug client service.
    http:
        client: httplug.client

    # The Slack API Incoming WebHooks URL.
    endpoint:             ~ # Required
    channel:              null
    username:             null
    icon:                 null
    link_names:           false
    unfurl_links:         false
    unfurl_media:         true
    allow_markdown:       true
    markdown_in_attachments: []

Excepted endpoint, all the other configuration keys are related to the Slack client default settings., (*11)

All those settings are described on the nexylan/slack documentation., (*12)

Usage

The Slack client instance can be retrieved from the nexy_slack.client service., (*13)

Here is an example:, (*14)

<?php

namespace AppBundle\Controller;

use Nexy\Slack\Attachment;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    public function indexAction()
    {
        $slack = $this->get('nexy_slack.client');

        $message = $slack->createMessage();

        $message
            ->to('#test')
            ->from('John Doe')
            ->withIcon(':ghost:')
            ->setText('This is an amazing message!')
        ;

        $message->attach((new Attachment())
             ->setFallback('Some fallback text')
             ->setText('The attachment text')
         );

        $slack->sendMessage($message);
    }
}

All the how to manipulate the Slack client is on the nexylan/slack documentation., (*15)

The Versions

18/01 2018

1.x-dev

1.9999999.9999999.9999999-dev

Symfony bundle integration of maknz/slack library

  Sources   Download

MIT

The Requires

 

The Development Requires

18/01 2018

v1.1.2

1.1.2.0

Symfony bundle integration of maknz/slack library

  Sources   Download

MIT

The Requires

 

The Development Requires

18/01 2018

dev-symfony-4

dev-symfony-4

Symfony bundle integration of maknz/slack library

  Sources   Download

MIT

The Requires

 

The Development Requires

17/01 2018

dev-travis-fix

dev-travis-fix

Symfony bundle integration of maknz/slack library

  Sources   Download

MIT

The Requires

 

The Development Requires

17/01 2018
23/12 2016