Download the PHP package tdx/notify-laravel without Composer

On this page you can find all versions of the php package tdx/notify-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package notify-laravel

Notify-Laravel

A simple PHP package for sending notifications from laravel via Slack with incoming webhooks or via email. This package will automatically format an instance of exception object, string text, or an array for a message. While sending an exception as a message, it will attach an information of "user agent", "request uri", and "ip address. For Laravel, using this class in a Exceptions\Handler.php class is prefered.

Requirements

Installation

1. Use composer to install this package.

2. Add 'provider' and 'alias' for config\app.php. (No need above Laravel 5.5. Thanks to Auto-Discovery feature! YaY)

3. Publish necessary config and view files.

add --force option to overwrite previously published files.

These commands should create

If these publish commands does not work, try

It will clear the config cache.

4. Create an incoming webhook on your Slack account. You need to write Webhook URL in config\slack.php file to send a message via Slack.

Settings

Write values for some config files.

In config\slack.php,

In .env, set suitable values for mail,

and add

If the value = true, the adapter is turned on (The adapter can send a message). If the value = false, the adapter is turned off (The adapter cannot send a message). If there is no value defined in .env file, false is used as default. Mention will be attached at the beginning of the content.

How to send Messages

This class automatically formats and sends an message. The content can be an exception object, string, or an array.

Options for Adapters

For SlackAdapter,

Parameter Type Description
to string channel or username that messages is going to be sent to.
from string username for the message.
icon string The icon URL or stamp string. (e.g.) :smile:
fields array has UserAgent and RequestUri if there exist.
max_retry bool maximum number of retries. (default max_retry = 3)
force bool forces to send if it is true. Otherwise, do not force (follows to config/active values).
mention string mention is attached at the beginning of the content. (e.g.) '@channel'
raw bool send text without formatting if it is true.

For MailAdapter,

Parameter Type Description
to string email address that messages is going to be sent to.
from string username for the email. This does not need to be actual email address.
subject string subject for the email.
fields array has UserAgent and RequestUri if there exist.
max_retry bool maximum number of retries. (default max_retry = 3)
force bool force to send if it is true. Otherwise, do not force (follow to active values).

Example of Implementation using Laravel Exception Handler

In App\Exceptions\Handler class,

How to Create Other Adapter

  1. Create a class which implements AdapterInterface in an Adapters folder.
  2. Name the class to xxxAdapter. xxx will be an adapter name that is going to be called.
  3. Modify config/config.php file to define default values for the adapter.

Notes

If an adapter failed to send a message, it will automatically retry to send it. Write ['max_retry' = SOME_NUMBER] in the options array to change the number of attempts (default max_retry = 3). If all attempts failed, it will throw NotifyException. To get more specific info about the error, you should check laravel.log file (The log file captures errors for all attempts).


All versions of notify-laravel with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
laravel/framework Version >=5.3
laravel/slack-notification-channel Version ^2.3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tdx/notify-laravel contains the following files

Loading the files please wait ....