2017 © Pedro Peláez
 

library slack

A library for working with Slack.

image

hybridlogic/slack

A library for working with Slack.

  • Monday, July 18, 2016
  • by Dachande663
  • Repository
  • 1 Watchers
  • 2 Stars
  • 33 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHP Slack

A library of useful classes for working with Slack., (*1)

At the moment this library is mainly focused on slash commands but may grow in the future. It supports defining multiple commands and matching actions within them., (*2)

Build Status Packagist, (*3)

0.0 Table of Contents

  1. Introduction
  2. Install
  3. Examples
  4. Running Tests
  5. Troubleshooting
  6. Changelog

1.0 Introduction

Slack is a cross-platform messaging platform that offers multiple integrations with third-party services. One of the most useful of these integrations is in the form of slash commands e.g., (*4)

/cinema movies tonight

Slash commands make a HTTP POST request to a server and display the result to the user. This library aims to make dealing with these commands a bit simpler, including:, (*5)

  • Parsing the incoming data
  • Matching text against command patterns
  • Ensuring security tokens match
  • Filtering available teams, channels and users
  • Serving responses
  • Handling delayed responses

At the moment there is no support for the Slack Web API or RTM as these have been done elsewhere by others. This library lets you get a slash command online quickly and easily. Look in the examples directory for more info., (*6)

2.0 Installation

PHP Slack is available on Composer via Packagist. To install simply run:, (*7)

composer require hybridlogic/slack

Alternatively clone the git repository and use a PSR-4 compatible autoloader., (*8)

3.0 Examples

Slack::dispatcher()
    ->setFilter(
        Slack::filter()
            ->allowedTeamIds('T01234567')
            ->allowedUserIds('U01234567')
    )
    ->addCommand(
        Slack::command('ABCDEF01234567')
            ->on('', function(){
                return Slack::response('Welcome to this command');
            })
            ->on('^say (.+)$', function($req){
                $text = $req->param(0);
                return Slack::response("Hello $text");
            })
    )
    ->dispatch(Slack::request())
    ->serve()
;

4.0 Running Tests

phpunit tests, (*9)

5.0 Troubleshooting

Make sure you meet the requirements for running a slash command host i.e. publicly accessible and served over HTTPS., (*10)

6.0 Changelog

  • [2016-02-21] Initial release

The Versions

18/07 2016

dev-master

9999999-dev https://github.com/Dachande663/PHP-Slack

A library for working with Slack.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

message slack hybridlogic

18/07 2016

0.2.0

0.2.0.0 https://github.com/Dachande663/PHP-Slack

A library for working with Slack.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

message slack hybridlogic

23/02 2016

0.1.0

0.1.0.0 https://github.com/Dachande663/PHP-Slack

A library for working with Slack.

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

message slack hybridlogic