There is no license information available for the latest version (v0.16.0) of this package.

MessageGears notification drivers for Laravel.

v0.16.0 2022-08-02 21:45 UTC


PHP Composer

This is an API wrapper for MessageGears specifically for Laravel. This package providers a fluent syntax for sending MessageGears requests and notifications in Laravel.

composer require actengage/laravel-message-gears


Define the MessageGears config in the config/services.php file. Any value here is considered the global default and can be overriden on a per-request basis.

// config/services.php

return [
    'messagesgears' => [
        'api_key' => '...',
        'account_id' => '...',
        'campaign_id' => '...',

Laravel Notification

Using the default notification is simple. Instantiate the notification and pass the parameters. Any parameters will override global or defaults values.

use Actengage\LaravelMessageGears\Notifications\SendTransactionalCampaign;

$user = new User();
$user->email = '';
$user->notify(new SendTransactionalCampaign([
    'campaignId' => 'CAMPAIGN_ID'

Submit Transactional Campaign

Manually send a transactional campaign using the service provider.

    'campaignId' => 'CAMPAIGN_ID',
    'recipient' => [
        'email' => ''

Fluent Message Builder

You can also instantiate the fluent message builder and send the message directly.

use Actengage\LaravelMessageGears\TransactionalCampaignSubmit;

$message = (new TransactionalCampaignSubmit)
    ->context('some.nested.context', true);


Custom Notifications

This is an example of notification. The toTransactionalCampaign campaign must return an instance of Actengage\LaravelMessageGears\TransactionalCampaignSubmit.


namespace Actengage\LaravelMessageGears\Notifications;

use Illuminate\Notifications\Notification;
use Actengage\LaravelMessageGears\TransactionalCampaignChannel;
use Actengage\LaravelMessageGears\Messages\TransactionalCampaignSubmit;

class SendTransactionalCampaign extends Notification
     * The notification params.
     * @var  array  $params
    public $params;

     * The notification constructor.
     * @param  array  $params
     * @return void
    public function __construct(array $params = [])
        $this->params = $params;    
     * Get the notification channels.
     * @param  mixed  $notifiable
     * @return array|string
    public function via($notifiable)
        return [TransactionalCampaignChannel::class];

     * Cast the notification as a transactional campaign message.
     * @param  array  $params
     * @return \Actengage\LaravelMessageGears\TransactionalCampaignSubmit
    public function toTransactionalCampaign($notifiable)
        return new TransactionalCampaignSubmit($this->params);