Download the PHP package jivesh/laravel-slack without Composer
On this page you can find all versions of the php package jivesh/laravel-slack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jivesh/laravel-slack
More information about jivesh/laravel-slack
Files in jivesh/laravel-slack
Package laravel-slack
Short Description A minimalist laravel integration for Slack
License MIT
Homepage https://gahlawat.github.io/laravel-slack
Informations about the package laravel-slack
laravel-slack
A very tiny and lightweight integration with the Slack API for posting notifications or any kind of messages to your team's Slack account.
- Requirements
- Installation
- Registering the Package
- Configuration
- Usage
Requirements
- Laravel Framework 5+
Installation
Using Composer package manager, install this package by running following command in your project root:
Registering the Package
-
This package supports auto discovery feature introduced in Laravel v5.5, hence it is auto registered. You may skip to 'Configuration' section below.
-
If your app is on Laravel v5.4 or below, follow below steps to register:
- In your file, append the following code into your array for integrating the Service Provider for package.
- Again in your file, copy the following code into your array for a nice Laravel syntax using Facades.
Configuration
-
Create an incoming webhook on your Slack account for the package to use and copy the generated Webhook URL.
-
Run the following command in project root directory to generate config file for package.
- Now edit and paste value for generated in the first step above.
- You may optionally set a default username and emoji icon displayed in your Slack app from here.
Usage
-
Send any message in real time to your Slack account using this anywhere in your php code:
-
The backslash indicates global namespace scope for this function, you may import Slack namespace on top of your file by it:
-
Then, you can call this Facade without a as:
- You can change the default name and/or display icon in your Slack app for any message by using optional second and third parameter.
- To send this message privately to any user, use the fourth parameter as @username
- To send this message publicly to any channel, use the fourth parameter as #channel
See this cheat sheet of available emoji icons.