Download the PHP package lostlink/laravel-messenger without Composer
On this page you can find all versions of the php package lostlink/laravel-messenger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lostlink/laravel-messenger
More information about lostlink/laravel-messenger
Files in lostlink/laravel-messenger
Package laravel-messenger
Short Description Send Messages to an Ingestor
License
Homepage https://github.com/lostlink/messenger
Informations about the package laravel-messenger
LostLink Laravel-Messenger
LostLink Laravel-Messenger
is a Laravel package for sending messages to various services asynchronously without blocking the processing of your application. Messages are queued and sent during the PHP destruct()
phase, ensuring that the application’s performance is not impacted by external service communication.
Features
- Non-blocking message dispatch: Messages are processed after the PHP request lifecycle.
- Extensible driver system: Add custom drivers to send messages to services of your choice.
- Simple configuration: Set up different drivers with environment variables.
- Rate limiting: Control the rate at which messages are sent to avoid exceeding service limits.
Supported Drivers
Installation
-
Install the package via Composer:
-
Publish the configuration file (optional):
- Configure the environment variables for the drivers you wish to use.
Configuration
The package supports multiple drivers, and you can set the default driver using environment variables. Here’s an example configuration file:
Available Environment Variables
Option | Description |
---|---|
LARAVEL_MESSENGER_DRIVER |
Specifies the driver to use (log , kinesis , or tinybird ). |
LARAVEL_MESSENGER_LOG_RATE_LIMIT_ENABLED |
Enable rate limiting for the log driver. |
LARAVEL_MESSENGER_LOG_RATE_LIMIT_MAX_ATTEMPTS |
The maximum number of attempts before rate limiting is enforced for the Log driver. A value of 0 is the same a being disabled |
LARAVEL_MESSENGER_LOG_RATE_LIMIT_DECAY_SECONDS |
The number of seconds before the rate limit resets for the log driver. |
LARAVEL_MESSENGER_KINESIS_STREAM_NAME |
The name of the Kinesis stream. |
LARAVEL_MESSENGER_KINESIS_STREAM_AWS_REGION |
The AWS region where the Kinesis stream is located. Defaults to AWS_DEFAULT_REGION if not set. |
LARAVEL_MESSENGER_KINESIS_STREAM_AWS_KEY |
The AWS access key for Kinesis. Defaults to AWS_ACCESS_KEY_ID . |
LARAVEL_MESSENGER_KINESIS_STREAM_AWS_SECRET_KEY |
The AWS secret key for Kinesis. Defaults to AWS_SECRET_ACCESS_KEY . |
LARAVEL_MESSENGER_KINESIS_RATE_LIMIT_ENABLED |
Enable rate limiting for the Kinesis driver. |
LARAVEL_MESSENGER_KINESIS_RATE_LIMIT_MAX_ATTEMPTS |
The maximum number of attempts before rate limiting is enforced for the Kinesis driver. A value of 0 is the same a being disabled |
LARAVEL_MESSENGER_KINESIS_RATE_LIMIT_DECAY_SECONDS |
The number of seconds before the rate limit resets for the Kinesis driver. |
LARAVEL_MESSENGER_TINYBIRD_DATA_SOURCE_NAME |
The name of the Tinybird data source. |
LARAVEL_MESSENGER_TINYBIRD_TOKEN |
The API token for Tinybird. |
LARAVEL_MESSENGER_TINYBIRD_ENDPOINT |
The Tinybird API endpoint. Defaults to https://api.us-east.aws.tinybird.co/v0/events . |
LARAVEL_MESSENGER_TINYBIRD_RATE_LIMIT_ENABLED |
Enable rate limiting for the Tinybird driver. |
LARAVEL_MESSENGER_TINYBIRD_RATE_LIMIT_MAX_ATTEMPTS |
The maximum number of attempts before rate limiting is enforced for the Tinybird driver. A value of 0 is the same a being disabled |
LARAVEL_MESSENGER_TINYBIRD_RATE_LIMIT_DECAY_SECONDS |
The number of seconds before the rate limit resets for the Tinybird driver. |
Usage
Sending messages with LostLink Laravel-Messenger
is simple. After configuring your environment variables, you can use the send
method:
Updating Configuration on the Fly
You can modify the configuration for a specific message by chaining and passing an array to the config([])
method. This allows you to override the default driver settings for that particular message. Here's an example:
Adding Custom Drivers
To create and add your own driver, simply extend the driver system by implementing the required interfaces.
-
Make sure to publish the laravel-messenger config file
-
Adjust the laravel-messenger config with the name and class of your custom driver
- Create a class that extends \LostLink\Drivers\Driver `
License
This package is open-sourced software licensed under the MIT license.