PHPackages                             pragmatiqu/mailer - 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. [Templating &amp; Views](/categories/templating)
4. /
5. pragmatiqu/mailer

ActiveLibrary[Templating &amp; Views](/categories/templating)

pragmatiqu/mailer
=================

Sending Laravel Mails from Twig Templates

1.0.0(2y ago)012MITPHPPHP ^8.2

Since Apr 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/pragmatiqu/mailer)[ Packagist](https://packagist.org/packages/pragmatiqu/mailer)[ Docs](https://github.com/pragmatiqu/mailer)[ RSS](/packages/pragmatiqu-mailer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Sending Laravel Mails from Twig Templates
=========================================

[](#sending-laravel-mails-from-twig-templates)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e83b39ad192899fa48641529d12cb8ddaa94ebec96ede42a435ad93cb7c615ef/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f707261676d61746971752f6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pragmatiqu/mailer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/1a440e1119b812a04c551398d071514c40650a0237838dcc950bbbaa27f08622/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f707261676d61746971752f6d61696c65722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/pragmatiqu/mailer/actions?query=workflow%3ATests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/a04ba7456d945f49519b9de7364020c44da33014bbdea703c5c7c353c0100ad9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f707261676d61746971752f6d61696c65722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/pragmatiqu/mailer/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/7478173f4d832a70d236e4c73ca4c79abfa952411c291cb2e1eabf4583435a10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f707261676d61746971752f6d61696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pragmatiqu/mailer)

Send templated emails from twig templates.

Support us
----------

[](#support-us)

[Support Link](https://github.com/sponsors/mgerzabek)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require pragmatiqu/mailer
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Pragmatiqu\Mail\MailerServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

  /*
  |--------------------------------------------------------------------------
  | Transport
  |--------------------------------------------------------------------------
  |
  | This option controls the default transport that is used to send any email
  | messages sent by your application. Alternative transports may be setup
  | and used as needed; default transport will be used if not other stated.
  |
  */
  'default' => env( 'TRANSPORT', 'sendmail' ),

  'transports' => [
    'sendmail' => 'sendmail://default',
    'smtp'     => env( 'SMTP_DNS', 'smtp://:@:' ),
    'mailtrap' => env( 'MAILTRAP_DNS', 'smtp://:@smtp.mailtrap.io:2525' )
  ],

  /*
  |--------------------------------------------------------------------------
  | Global "From" Address
  |--------------------------------------------------------------------------
  |
  | You may wish for all e-mails sent by your application to be sent from
  | the same address. Here, you may specify a name and address that is
  | used globally for all e-mails that are sent by your application.
  |
  */
  'from'       => [
    'address' => env( 'FROM_ADDRESS', 'test@test.at' ),
    'name'    => env( 'FROM_NAME', 'Testing' ),
  ],

  /*
   |--------------------------------------------------------------------------
   | Template engine configuration
   |--------------------------------------------------------------------------
   |
   */
  'templates'  => [

    'root' => resource_path( 'mails' ),

    'extension'   => 'twig',

    // Accepts all Twig environment configuration options
    // @see https://twig.symfony.com/doc/3.x/api.html
    //
    'environment' => [

      // When set to true, the generated templates have a __toString() method
      // that you can use to display the generated nodes.
      // default: false
      'debug'            => env( 'APP_DEBUG', false ),

      // The charset used by the templates.
      // default: utf-8
      'charset'          => 'utf-8',

      // An absolute path where to store the compiled templates, or false to
      // disable caching. If null then the cache file path is used.
      // default: cache file storage path
      'cache'            => storage_path( 'mails/cache' ),

      // When developing with Twig, it's useful to recompile the template
      // whenever the source code changes. If you don't provide a value
      // for the auto_reload option, it will be determined automatically
      // based on the debug value.
      'auto_reload'      => true,

      // If set to false, Twig will silently ignore invalid variables
      // (variables and or attributes/methods that do not exist) and
      // replace them with a null value. When set to true, Twig throws an
      // exception instead.
      // default: false
      'strict_variables' => true,

      // If set to true, auto-escaping will be enabled by default for
      // all templates.
      // default: 'html'
      'autoescape'       => 'html',

      // A flag that indicates which optimizations to apply
      // (default to -1 -- all optimizations are enabled; set it to 0 to
      // disable)
      'optimizations'    => -1,
    ],
  ]
];
```

Usage
-----

[](#usage)

```
// fill in the blanks…
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Michael Gerzabek](https://github.com/mgerzabek)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

746d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23b715678ce3da96c250994583e20daf46d15b55ce8de931d77d1b5db4b84a35?d=identicon)[mgerzabek](/maintainers/mgerzabek)

---

Top Contributors

[![mgerzabek](https://avatars.githubusercontent.com/u/1590082?v=4)](https://github.com/mgerzabek "mgerzabek (44 commits)")

---

Tags

laraveltwigmailtemplates

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pragmatiqu-mailer/health.svg)

```
[![Health](https://phpackages.com/badges/pragmatiqu-mailer/health.svg)](https://phpackages.com/packages/pragmatiqu-mailer)
```

###  Alternatives

[hedronium/spaceless-blade

Adds the @spaceless tag to Blade. (works like in Twig)

32632.8k1](/packages/hedronium-spaceless-blade)[muratbsts/mail-template

This package is a easy to use mail template collection for Laravel 5.x.

191.3k](/packages/muratbsts-mail-template)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
