immortalvision / laravel-slack
A laravel integration for slack api
Requires
- php: ^7.4 || ^8.0
- guzzlehttp/guzzle: ^7.1.1
- maknz/slack: ~1.7.0
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-10-17 20:03:34 UTC
README
Laravel Slack
A laravel integration for slack api
Installation
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.
Laravel 5.5 and up
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.
Laravel 5.4 or 5.3
Add the following Service Provider to your config/app.php providers array:
ImmortalVision/LaravelSlack/LaravelSlackServiceProvider::class,
Publish Laravel Configuration Files (All Versions)
php artisan vendor:publish --provider="ImmortalVision\LaravelSlack\LaravelSlackServiceProvider"
Environment Variables
SLACK_WEBHOOK_URL=<insert_webhook_here>
Usage
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!'));
Dependencies
The library uses Guzzle as its HTTP communication layer.
We are using maknz/slack as the slack library for now.
License
The MIT License (MIT). Please see License File for more information.