pigeon / pigeon-laravel
Pigeon lets you easily manage your outbound email, push notifications and SMS. Visit https://pigeonapp.io for more details.
Requires
- illuminate/support: ^5.0
- pigeon/pigeon: ^0.2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
Suggests
- laravel/framework: To test the Laravel bindings
- laravel/lumen-framework: To test the Lumen bindings
This package is not auto-updated.
Last update: 2024-10-21 21:52:14 UTC
README
Pigeon lets you easily manage your outbound email, push notifications and SMS. Visit https://pigeonapp.io for more details.
Installation
Require via composer.
$ composer require pigeon/pigeon-laravel
Laravel
The package will be discovered for Laravel >=5.5. For Laravel <=5.4, add package to the list of service providers in config/app.php
'providers' => [
// ...
Pigeon\Laravel\PigeonServiceProvider::class,
];
Add the Pigeon facade alias in your config/app.php
.
'aliases' => [
// ...
'Pigeon' => Pigeon\Laravel\PigeonFacade::class,
];
Lumen
In Lumen, find the Register Service Providers
in your bootstrap/app.php
and register the Pigeon Service Provider.
$app->register(Pigeon\Laravel\PigeonServiceProvider::class);
Configuration
By default, the package uses PIGEON_PUBLIC_KEY
and PIGEON_PRIVATE_KEY
environment variables. To customize the configuration file, publish the package configuration using Artisan.
php artisan vendor:publish --provider="Pigeon\Laravel\PigeonServiceProvider" --tag="config"
or if using Laravel 5.5:
php artisan vendor:publish
The settings can be found in the generated config/pigeon.php
configuration file. By default, the keys would be retrieved from your .env file.
Usage
Prepare for the delivery
$message_identifier = 'message-identifier'; $parcels = ['to' => 'john@example.com'];
- Message identifier is used to identify the message. Grab this from your Pigeon dashboard.
- Parcels array accepts
to
,cc
,bcc
anddata
.
Deliver
Pigeon::deliver($message_identifier, $parcels);
Parcel sample (Single recipient)
$parcels = [ 'to' => 'John Doe <john@example.com>', 'cc' => [ 'admin@example.com', 'Sales Team <sales@example.com>' ], 'data' => [ // template variables are added here 'name' => 'John' ], 'attachments' => [ // `file` can be either local file path or remote URL [ 'file' => '/path/to/image.png', 'name' => 'Logo' ], [ 'file' => 'https://example.com/guide.pdf', 'name' => 'Guide' ] ] ];
Parcel sample (Multiple recipients)
$parcels = [ [ 'to' => 'John Doe <john@example.com>', 'data' => [ // template variables are added here 'name' => 'John' ] ], [ 'to' => 'Jane Doe <jane@example.com>', 'data' => [ // template variables are added here 'name' => 'Jane' ] ], ];
Contributing
You can contribute in one of three ways:
- File bug reports using the issue tracker.
- Answer questions or fix bugs on the issue tracker.
- Contribute new features or update the wiki.
The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.
License
The composer package is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the Pigeon project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.