Downloads
Stars
Version
A laravel integration for slack api
The recommended way to install this library is through Composer:
$ composer require immortalvision/laravel-slack
If you're not familiar with composer
follow the installation instructions for
Linux/Unix/Mac or
Windows, and then read the
basic usage introduction.
You don't have to do anything else, this package uses the Package Auto-Discovery feature, and should be available as soon as you install it via Composer.
Add the following Service Provider to your config/app.php providers array:
ImmortalVision/LaravelSlack/LaravelSlackServiceProvider::class,
php artisan vendor:publish --provider="ImmortalVision\LaravelSlack\LaravelSlackServiceProvider"
SLACK_WEBHOOK_URL=<insert_webhook_here>
you can use dependency injection feature in any method of your controller or resolve it through laravel service container:
using dependency injection:
Route::get('/', function (\Maknz\Slack\Client $slackClient) {
dd($slackClient->withIcon(':face_palm:')->send('test!'));
});
using service container:
$slackClient = resolve('Maknz\\Slack\\Client');
dd($slackClient->withIcon(':face_palm:')->send('test!'));
The library uses Guzzle as its HTTP communication layer.
We are using maknz/slack as the slack library for now.
The MIT License (MIT). Please see License File for more information.