PHPackages                             larablocks/pigeon - 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. larablocks/pigeon

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

larablocks/pigeon
=================

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

5.4.2(9y ago)143.7k1MITPHPPHP &gt;=5.6.4

Since May 12Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (16)Used By (0)

Pigeon
======

[](#pigeon)

[![Build Status](https://camo.githubusercontent.com/fef13c8066d5379d4899bd1a6e9485c7ad6171c906531737c525b8860e720ada/68747470733a2f2f7472617669732d63692e6f72672f6c617261626c6f636b732f706967656f6e2e737667)](https://travis-ci.org/larablocks/pigeon)[![Latest Stable Version](https://camo.githubusercontent.com/1e1246a65df53b9193d594edf0e9653d321871f449960677e32fc7cc638e600b/68747470733a2f2f706f7365722e707567782e6f72672f6c617261626c6f636b732f706967656f6e2f76657273696f6e)](https://packagist.org/packages/larablocks/pigeon)[![License](https://camo.githubusercontent.com/36329127e31b9d0c8d0f5dcef8c3d1616fa294b1fea73ff326e5de068820126f/68747470733a2f2f706f7365722e707567782e6f72672f6c617261626c6f636b732f706967656f6e2f6c6963656e7365)](https://packagist.org/packages/larablocks/pigeon)

A more flexible email message builder for Laravel 5 including chained methods, reusable message type configurations, and email layout and template view management.

> Note: All Larablocks packages will have releases in line with the major Laravel framework version release. (Ex. Pigeon 5.4.\* is tested to work with Laravel 5.4.\* while Pigeon 5.1.\* is tested to worked with Laravel 5.1.\*)

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

[](#installation)

Add `larablocks/pigeon` as a requirement to `composer.json`:

```
{
    "require": {
        "larablocks/pigeon": "~5.4"
    }
}
```

Update your packages with `composer update` or install with `composer install`.

Laravel Integration
-------------------

[](#laravel-integration)

To wire this up in your Laravel project you need to add the service provider. Open `app.php`, and add a new item to the providers array.

```
Larablocks\Pigeon\PigeonServiceProvider::class,
```

Then you may add a Facade for more convenient usage. In your `app.php` config file add the following line to the `aliases` array.

```
'Pigeon' => Larablocks\Pigeon\Pigeon::class,
```

Note: The Pigeon facade will load automatically, so you don't have to add it to the `app.php` file but you may still want to keep record of the alias.

To publish the default config file `config/pigeon.php` along with the default email view files use the artisan command:

`php artisan vendor:publish --provider="Larablocks\Pigeon\PigeonServiceProvider"`

If you wish to not publish the view files and only publish the config then use the artisan command:

`php artisan vendor:publish --provider="Larablocks\Pigeon\PigeonServiceProvider" --tag="config"`

Usage as a Facade
-----------------

[](#usage-as-a-facade)

```
Pigeon::
```

### Setting the General Message Properties

[](#setting-the-general-message-properties)

Pigeon will load all properties set in the `default` area of your config before you construct your message.

\####Set message addresses:

All these address add methods can be used with any of the address add functions (to, cc, bcc, replyTo, from, sender)

Add a single address with no name

```
Pigeon::to('john.doe@domain.com')
Pigeon::cc('john.doe@domain.com')
Pigeon::bcc('john.doe@domain.com')
Pigeon::replyTo('john.doe@domain.com')
Pigeon::from('john.doe@domain.com')
Pigeon::sender('john.doe@domain.com')
```

Add a single address with name

```
Pigeon::to('john.doe@domain.com', 'John Doe')
....
```

Add array of addresses with no names

```
Pigeon::to(['john.doe@domain.com', 'jane.doe@domain.com'])
...
```

Add array of addresses some with names, some without names

```
Pigeon::to(['john.doe@domain.com' => 'John Doe', 'jane.doe@domain.com'])
...
```

\####Set Subject:

```
Pigeon::subject('My Subject')
```

\####File Attachments:

Attach a single file with no options

```
Pigeon::attach('/path/to/file/attachment')
```

Attach a single file with options

```
Pigeon::attach('/path/to/file/attachment', ['as' => 'Attachment', 'mime' => 'jpg'])
```

Attach an array of files

```
Pigeon::attach([
    [
     'path' => '/path/to/file/attachment1'
     'options' => []
    ],
    [
     'path' => '/path/to/file/attachment2'
     'options' => ['as' => 'Attachment 2', 'mime' => 'pdf']
    ]
])
```

### Setting the Message View Properties

[](#setting-the-message-view-properties)

\####Set layout view file:

```
Pigeon::layout('emails.layouts.my_layout_view')
```

\####Set template view file:

```
Pigeon::template('emails.templates.my_template_view')
```

\####Passing View Variables:

Passing simple variables:

```
Pigeon::pass([
 'stringVariable' => 'test string',
 'intVariable' => 2,
 'boolVariable' => true
])
```

Passing object variables:

```
$user = new User();
$user->first_name = 'John';
$user->last_name = 'Doe';
Pigeon::pass([
 'userObjectVariable' => $user
])
```

If `pass()` is used more than once it will merge previously passed variables with the current passed set.

> Note: Make sure all variables pre-defined in your layout and template view files are passed to your Pigeon message.

\####Clearing View Variables:

Clear all previously passed view variables

```
Pigeon::clear()
```

### Custom Messages Types

[](#custom-messages-types)

Custom message types will be configured in the `config/pigeon.php` file. In this file you can find examples on how to properly set up a custom message type.

#### Default:

[](#default)

Set your defaults for all messages sent with Pigeon in `config\pigeon.php`

```
'default' => [
    'to' => [],
    'cc' => [],
    'bcc' => [],
    'replyTo' => [],
    'from' => [], // if nothing is entered here, your mail.php default will still be used
    'sender' => [],
    'attachments' => [],
    'subject' => 'Pigeon Delivery',
    'layout' => 'emails.layouts.default',
    'template' => 'emails.templates.default',
    'message_variables' => []
]
```

\####Load Custom Message:

Set your defaults for a particular message type to be sent with Pigeon in `config\pigeon.php`

```
'custom_message_type' => [
    'from' => ['from@myapp.com' => 'My Custom App'],
    'subject' => 'My Pigeon Custom Message',
    'layout' => 'emails.layouts.default',
    'template' => 'emails.templates.default'
]
```

This will load all the message properties from your config defined for `custom_message_type`.

```
Pigeon::type('custom_message_type');
```

#### Order of Loading:

[](#order-of-loading)

Default -&gt; Custom Message (if set and loaded) -&gt; Properties set with individual Pigeon functions

### Sending the Message

[](#sending-the-message)

\####Send Message:

```
Pigeon::send();
```

\####Send Raw Message:

Pass a string as a param for the send() function and it will use the string as a raw message send and will ignore any view files or view variables assigned.

```
Pigeon::send('This is my raw message');
```

### Example - Using it all together

[](#example---using-it-all-together)

```
Pigeon::to(['john.doe@domain.com', 'jane.doe@domain.com'])
->cc('fred.doe@domain.com')
->bcc('george.doe@domain.com')
->subject('This is the Subject')
->attach('/path/to/file/attachment')
->layout('emails.layouts.my_layout_view')
->template('emails.templates.my_template_view')
->pass(['firstVariable' => 'test string', 'secondVariable' => 2, 'thirdVariable' => true])
->send();
```

### Example - Simple call

[](#example---simple-call)

```
Pigeon::to('me@domain.com')->subject('Testing Pigeon')->send('Sending myself a quick raw message');
```

### Example - Sending a custom message

[](#example---sending-a-custom-message)

```
Pigeon::type('custom_message_type')->to('me@domain.com')->send();
```

Usage as a Passed Dependency
----------------------------

[](#usage-as-a-passed-dependency)

To pass Pigeon as a dependency will will pass the interface `Larablocks\Pigeon\PigeonInterface`. For now the only library that implements this interface is `Larablocks\Pigeon\IlluminateMailer` provided by Laravel but we want to allow for other mailing libraries to be used in the future. The `config/pigeon.php` config file for Pigeon automatically sets IlluminateMailer as the default mailer library for you.

```
'library' => 'IlluminateMailer',
```

\###Passing Pigeon to a constructor:

```
public function __construct(Larablocks\Pigeon\PigeonInterface $pigeon)
{
$this->pigeon = $pigeon;
}
```

\###Starting a new default message:

```
$this->pigeon->to('me@domain.com')->subject('Pigeon Raw Test Message')->send('Sending myself a quick raw message');
```

\###Starting a new custom message type:

```
$this->pigeon->type('custom_message_type')->to('me@domain.com')->send();
```

License
-------

[](#license)

Pigeon is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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

Every ~52 days

Recently: every ~117 days

Total

15

Last Release

3286d ago

Major Versions

0.2.1 → 5.0.02015-06-01

PHP version history (3 changes)0.1PHP &gt;=5.4

5.1.0PHP &gt;=5.5.9

5.4.0PHP &gt;=5.6.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/964dc41092188416a5ade7be0bea1b81079ae8e236731ea5d2ed8d9d3868efab?d=identicon)[emitkowski](/maintainers/emitkowski)

---

Top Contributors

[![emitkowski](https://avatars.githubusercontent.com/u/4722552?v=4)](https://github.com/emitkowski "emitkowski (10 commits)")

---

Tags

laravelmailmailerpigeonmessagelaravelmailemailbuildertemplatemailerlaravel 5viewspigeon

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/larablocks-pigeon/health.svg)

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

###  Alternatives

[duncan3dc/blade

Use Laravel Blade templates without the full Laravel framework

160499.5k24](/packages/duncan3dc-blade)[dansmaculotte/laravel-mail-template

A mail template driver to send emails with

353.0k](/packages/dansmaculotte-laravel-mail-template)[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)
