PHP code example of stechstudio / slack-laravel-api
1. Go to this page and download the library: Download stechstudio/slack-laravel-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
stechstudio / slack-laravel-api example snippets
/*
|--------------------------------------------------------------------------
| Slack Webhook Routes
|--------------------------------------------------------------------------
|
| Here is where you can register Slack routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "slack" middleware group. Enjoy building your API!
|
*/
Route::middleware('slack')->match(['get', 'post'], '/slack/api', 'STS\Slack\Http\Controllers\Slack@webhook');
useSTS\Slack\Facades\SlackRoute;
useSTS\Slack\SlashCommands\Echoes;
/*
|--------------------------------------------------------------------------
| Slack Command Routes
|--------------------------------------------------------------------------
|
| Here is where you can register Slack commands for your application.
|
*/
SlackRoute::handles('/hello', function(SlashCommand $slashCommand){
return'Hello World';
});
SlackRoute::handles('/echo', Echoes::class);