All Projects → nexylan → Slack Bundle

nexylan / Slack Bundle

Licence: mit
Symfony bundle integration of the nexylan/slack library.

Projects that are alternatives of or similar to Slack Bundle

Liipcachecontrolbundle
DEPRECATED! This bundle is superseded by FOSHttpCacheBundle. A migration guide is in the README of LiipCacheControlBundle
Stars: ✭ 108 (-1.82%)
Mutual labels:  symfony, symfony-bundle
Notification Bundle
A simple Symfony bundle to notify user
Stars: ✭ 103 (-6.36%)
Mutual labels:  symfony, symfony-bundle
Service Bus Symfony Bundle
Symfony Bundle - PHP Lightweight Message Bus supporting CQRS
Stars: ✭ 90 (-18.18%)
Mutual labels:  symfony, symfony-bundle
Web Server Bundle
WebServerBundle provides commands for running applications using the PHP built-in web server. It simplifies your local development setup because you don't have to configure a proper web server such as Apache or Nginx to run your application.
Stars: ✭ 1,281 (+1064.55%)
Mutual labels:  symfony, symfony-bundle
Knppaginatorbundle
SEO friendly Symfony paginator to sort and paginate
Stars: ✭ 1,534 (+1294.55%)
Mutual labels:  symfony, symfony-bundle
Syliuselasticsearchplugin
Elasticsearch integration for Sylius apps.
Stars: ✭ 88 (-20%)
Mutual labels:  symfony, symfony-bundle
Event Store Symfony Bundle
Event Store Symfony Bundle
Stars: ✭ 93 (-15.45%)
Mutual labels:  symfony, symfony-bundle
Sonataclassificationbundle
Symfony SonataClassificationBundle
Stars: ✭ 76 (-30.91%)
Mutual labels:  symfony, symfony-bundle
Fosjsroutingbundle
A pretty nice way to expose your Symfony2 routing to client applications.
Stars: ✭ 1,358 (+1134.55%)
Mutual labels:  symfony, symfony-bundle
Easy Doc Bundle
Symfony application documentation generator
Stars: ✭ 99 (-10%)
Mutual labels:  symfony, symfony-bundle
Pugxautocompleterbundle
Add an autocomplete field to your Symfony forms
Stars: ✭ 83 (-24.55%)
Mutual labels:  symfony, symfony-bundle
Filemanagerbundle
FileManager is a simple Multilingual File Manager Bundle for Symfony
Stars: ✭ 105 (-4.55%)
Mutual labels:  symfony, symfony-bundle
Knpmenubundle
Object Oriented menus for your Symfony project.
Stars: ✭ 1,242 (+1029.09%)
Mutual labels:  symfony, symfony-bundle
Swarrotbundle
A symfony bundle for swarrot integration
Stars: ✭ 89 (-19.09%)
Mutual labels:  symfony, symfony-bundle
Dictionarybundle
Are you often tired to repeat static choices like gender or civility in your apps ?
Stars: ✭ 79 (-28.18%)
Mutual labels:  symfony, symfony-bundle
Whiteoctobertcpdfbundle
A bundle to facilitate using TCPDF for PDF generation in Symfony applications
Stars: ✭ 91 (-17.27%)
Mutual labels:  symfony, symfony-bundle
Dms Filter Bundle
Provides a FilterService for Symfony to allow users to implement input filtering in entities using Annotations
Stars: ✭ 74 (-32.73%)
Mutual labels:  symfony, symfony-bundle
Twigextensionsbundle
Useful Twig extensions for your Symfony project.
Stars: ✭ 75 (-31.82%)
Mutual labels:  symfony, symfony-bundle
Easy Security Bundle
EasySecurityBundle
Stars: ✭ 95 (-13.64%)
Mutual labels:  symfony, symfony-bundle
Liipimaginebundle
Symfony Bundle to assist in imagine manipulation using the imagine library
Stars: ✭ 1,516 (+1278.18%)
Mutual labels:  symfony, symfony-bundle

NexySlackBundle

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

Latest Stable Version Latest Unstable Version License Dependency Status Reference Status

Total Downloads Monthly Downloads Daily Downloads

Build Status Scrutinizer Code Quality Code Climate Coverage Status SensioLabsInsight

Documentation

All the installation and usage instructions are located in this README. Check it for specific version:

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

Prerequisites

This version of the project requires:

  • PHP 7.1+
  • Symfony 3.4+

Installation

First of all, you need to require this library through composer:

$ composer require nexylan/slack-bundle php-http/guzzle6-adapter

Why php-http/guzzle6-adapter? We are decoupled from any HTTP messaging client thanks to HTTPlug.

Then, enable the bundle on the AppKernel class:

// 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.

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

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.

All those settings are described on the nexylan/slack documentation.

Usage

The Slack client instance can be retrieved from the nexy_slack.client service.

Here is an example:

<?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('👻')
            ->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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].