immortalvision/laravel-slack

A laravel integration for slack api

v1.0.3 2021-01-17 11:55 UTC

This package is auto-updated.

Last update: 2024-11-17 20:15:06 UTC


README

Build Status StyleCI Total Downloads Latest Stable Version License

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.