mountain/laraslack

A simple package to automatically send alerts to a slack channel

Installs: 198

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/mountain/laraslack

v0.1.0 2021-10-15 14:34 UTC

This package is auto-updated.

Last update: 2025-12-15 23:49:44 UTC


README

About

A Basic Slack integration for Laravel projects

Usage

Register a helper function instantiating the LaraSlack class e.g.

function laraslack($content) {
	return new \ThomasMountain\LaraSlack\LaraSlack($content);
}

Required ENV

  • SLACK_WEB_HOOK_URL=
    • String
    • The Slack web hook url
  • SLACK_CHANNEL=
    • String
    • The channel or user to send the message to
  • SLACK_USERNAME=
    • String
    • The username to send the message as
  • SLACK_ICON=
    • String
    • The icon to be sent with the message (wrapped in ':' i.e 📈)
  • SLACK_SEND=
    • Boolean
    • Determines wether the message will be sent
    • Set to false in testing environments

Overriding Defaults

You can pass an array to the send() method to overwride the defaults specified in the .env file. The array keys are:

  • channel
  • message
  • username
  • icon

Any array keys that are not passed through will take the defaults from the config

E.G:

laraslack([
    'channel' => 'Dummy Channel',
    'icon'    => ':bananadance:',
    'message  => 'message goes here'
]);

** Remember to pass through an array key for 'message' when doing this **