PHP code example of hybridlogic / slack

1. Go to this page and download the library: Download hybridlogic/slack library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hybridlogic / slack example snippets


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