PHPackages                             actengage/laravel-message-gears - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. actengage/laravel-message-gears

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

actengage/laravel-message-gears
===============================

MessageGears notification drivers for Laravel.

v1.0.0(1y ago)02.6kPHPPHP ^8.1

Since Jun 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ActiveEngagement/laravel-message-gears)[ Packagist](https://packagist.org/packages/actengage/laravel-message-gears)[ RSS](/packages/actengage-laravel-message-gears/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (28)Used By (0)

MessageGears
============

[](#messagegears)

[![PHP Composer](https://github.com/actengage/laravel-message-gears/workflows/PHP%20Composer/badge.svg)](https://github.com/actengage/laravel-message-gears/workflows/PHP%20Composer/badge.svg)

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

```

Config
------

[](#config)

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
--------------------

[](#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\MessageGears\Notifications\SendTransactionalCampaign;

$user = new User();
$user->email = 'test@test.com';
$user->save();
$user->notify(new SendTransactionalCampaign([
    'campaignId' => 'CAMPAIGN_ID'
]));
```

Submit Transactional Campaign
-----------------------------

[](#submit-transactional-campaign)

Manually send a transactional campaign using the service provider.

```
app('messagegears')->submitTransactionCampaign([
    'campaignId' => 'CAMPAIGN_ID',
    'recipient' => [
        'email' => 'test@test.com'
    ]
]);
```

Fluent Message Builder
----------------------

[](#fluent-message-builder)

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

```
use Actengage\MessageGears\TransactionalCampaignSubmit;

$message = (new TransactionalCampaignSubmit)
    ->accountId(1)
    ->apiKey('API_KEY')
    ->to('test@test.com')
    ->context('some.nested.context', true);

app('messagegears')->submitTransactionalCampaign($message)
```

Custom Notifications
--------------------

[](#custom-notifications)

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

```
