2017 © Pedro PelĂĄez
 

library slack-api

Slack Integration

image

clawrock/slack-api

Slack Integration

  • Wednesday, January 10, 2018
  • by clawrock
  • Repository
  • 2 Watchers
  • 2 Stars
  • 22 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

Slack-API

Introduction

Slack-API lets you build simple response system for slack's slash command API., (*1)

Installation

For production make sure you have composer installed. Then run:, (*2)

composer require clawrock/slack-api

After installing, you need to require Composer's autoloader:, (*3)

require 'vendor/autoload.php';

Code Examples

Basic example with anonymous function., (*4)

use ClawRock\Slack\SlackFactory;

//Create new dispatcher
$dispatcher = SlackFactory::dispatcher();


//Add commands to respond to your request
$dispatcher->addCommand(SlackFactory::slashCommand('your-command-token')
          ->run(function ($req, $res){
                $res->addText('Hello world!');
          }))->dispatch(SlackFactory::getRequest())
      ->create()
      ->toRequest()
      ->serve();

You can also add Guard to manage the user/team/channel permissions., (*5)

use ClawRock\Slack\Enums\Permissions;

$dispatcher->addGuard(SlackFactory::guard()
        ->defaultBehavior(Permissions::DenyAll())
        ->allowUserIds(['U01'])
        ->allowTeamIds(['T01']))
    ->addCommand(//commands)
    ->dispatch(SlackFactory::getRequest())
    ->create()
    ->toRequest()
    ->serve();

It's worth to notice that every callable object can be used in addCommand() method., (*6)

You can send messages via Incoming webhooks, (*7)

use ClawRock\Slack\SlackFactory;

SlackFactory::getMessageService('')->sendText("Hello world!");

Documentation

There are very well documented examples in examples/ directory. You should take a look on them., (*8)

Tests

Simply run, (*9)

vendor/bin/phpunit

Requirements

Slack API requires server with SSL enabled. Please refer to the Slack's API reference to get more informations., (*10)

Contributing

If you wish to participate in the development, you may use grunt to generate the documentation files. To do so make sure you have node and npm installed., (*11)

$ node -v
v4.7.0
$ npm -v
2.15.11

Then run, (*12)

$ npm install
$ grunt init

And then to generate docs run, (*13)

grunt build

This will also launch unit tests., (*14)

Credits

Slack-API was initiated with generator-composer, a Yeoman generator that builds a PHP Composer project., (*15)

This project uses the following as development dependencies:, (*16)

License

Author: cr-team office@clawrock.com, (*17)

The Versions

10/01 2018

dev-master

9999999-dev http://clawrock.com/

Slack Integration

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

slack integration clawrock

10/01 2018

1.6.0

1.6.0.0 http://clawrock.com/

Slack Integration

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

slack integration clawrock

10/08 2017

1.5.4

1.5.4.0 http://clawrock.com/

Slack Integration

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

slack integration clawrock

09/08 2017

1.5.2

1.5.2.0 http://clawrock.com/

Slack Integration

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

slack integration clawrock

04/08 2017

1.0.0

1.0.0.0 http://clawrock.com/

Slack Integration

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

slack integration clawrock

13/01 2017

v0.1.1-alpha

0.1.1.0-alpha http://www.prowebsoft.com/

Slack Integration

  Sources   Download

MIT

The Requires

 

The Development Requires

slack integration prowebsoft

13/01 2017

v0.1-alpha

0.1.0.0-alpha http://www.prowebsoft.com/

Slack Integration

  Sources   Download

MIT

The Requires

 

The Development Requires

slack integration prowebsoft