| Package Data | |
|---|---|
| Maintainer Username: | Mathieu Bour | 
| Maintainer Contact: | mathieu.tin.bour@gmail.com (Mathieu Bour) | 
| Package Create Date: | 2020-05-29 | 
| Package Last Update: | 2020-07-26 | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-10-28 03:05:15 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 1,329 | 
| Monthly Downloads: | 0 | 
| Daily Downloads: | 0 | 
| Total Stars: | 1 | 
| Total Watchers: | 1 | 
| Total Forks: | 0 | 
| Total Open Issues: | 0 | 
Allow to use the Mailjet Templating Language in Laravel mailables.
This package is not supported by Mailjet.
This package follows the Semantic Versioning specification.
| laravel-mailjet | Laravel / Lumen | |-----------------|-----------------| | ^1.0.0 | ^6.0 || ^7.0 |
Simply add the package to your dependencies.
composer require mathieu-bour/laravel-mailjet
The package support the Package Discovery.
Add the service provider to your bootstrap/app.php.
In the config/services.php, add the following entry:
return [
    // ...
    'mailjet'   => [
        'key'     => 'your-mailjet-key',
        'secret'  => 'your-mailjet-secret',
        'call'    => true, // can be set to false to mock requests
        'options' => ['version' => 'v3.1'], // additional Mailjet options, see https://github.com/mailjet/mailjet-apiv3-php#options
    ],
    // ...
];
You can now use the class Windy\Mailjet\MailjetTemplateMailable as a base for your emails.
Example:
use Windy\Mailjet\MailjetTemplateMailable;
class PasswordForgottenMail extends MailjetTemplateMailable
{
    /** @var int The Mailjet Template ID. */
    protected $templateId = 1185614;
    public $firstName;
    public $resetLink;
    public function __construct(User $user)
    {
        // You can now use {{var:firstName}} and {{var:resetLink}} variables in your Mailjet templates
        $this->firstName = $user->firstname ?? $user->username ?? '';
        $this->resetLink = 'https://mysite.com/password-reset?token=' . $user->token;
    }
}