PHP code example of larablocks / pigeon

1. Go to this page and download the library: Download larablocks/pigeon library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

larablocks / pigeon example snippets


Larablocks\Pigeon\PigeonServiceProvider::class,

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

Pigeon::

Pigeon::to('[email protected]') 
Pigeon::cc('[email protected]') 
Pigeon::bcc('[email protected]') 
Pigeon::replyTo('[email protected]') 
Pigeon::from('[email protected]') 
Pigeon::sender('[email protected]') 

Pigeon::to('[email protected]', 'John Doe')
....

Pigeon::to(['[email protected]', '[email protected]']) 
...

Pigeon::to(['[email protected]' => 'John Doe', '[email protected]']) 
...

Pigeon::subject('My Subject') 

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

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

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

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

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

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

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

Pigeon::clear()

'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' => []
]

'custom_message_type' => [
    'from' => ['[email protected]' => 'My Custom App'],
    'subject' => 'My Pigeon Custom Message',
    'layout' => 'emails.layouts.default',
    'template' => 'emails.templates.default'
]

Pigeon::type('custom_message_type');

Pigeon::send();

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

Pigeon::to(['[email protected]', '[email protected]'])
->cc('[email protected]')
->bcc('[email protected]')
->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();

Pigeon::to('[email protected]')->subject('Testing Pigeon')->send('Sending myself a quick raw message');

Pigeon::type('custom_message_type')->to('[email protected]')->send();

'library' => 'IlluminateMailer',

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

$this->pigeon->to('[email protected]')->subject('Pigeon Raw Test Message')->send('Sending myself a quick raw message');

$this->pigeon->type('custom_message_type')->to('[email protected]')->send();
config\pigeon.php
config\pigeon.php