A laravel package to easily integrate plunk
PHP 7.2+ and Composer are required.
To get the latest version of Laravel Plunk, simply require it
composer require toyosi12/laravel-plunk
Once installed, the package automatically registers its service provider and facade.
PLUNK_SECRET_KEY="<SECRET_KEY>"
Login to your Plunk dashboard to obtain your secret key.
use Toyosi12\Plunk\Facades\Plunk;
Plunk::countContacts();
- triggerEvent() Used to publish an event
Parameters
- event: The name of the event to publish
- email: The email address of the user to publish the event to
- data [Optional]: An object containing the data to attach to the user
Sample request:
use Toyosi12\Plunk\Facades\Plunk;
$request = {
"event": "test-project",
"email": "toyosi@nomail.com"
}
Plunk::triggerEvent($request);
- sendTransactionalEmail() Used to send transactional email
Parameters
- to: The email address of the recipient
- subject: The subject of the email
- body: The body of the email
- type [Optional]: The type of email to send (html or markdown)
- from [Optional]: The email address of the sender
- name [Optional]: The name of the sender
- withUnsubscribe [Optional]: Whether to include an unsubscribe link hosted by Plunk in the email
Sample request:
use Toyosi12\Plunk\Facades\Plunk;
$request = {
"to": "toyosi@nomail.com",
"subject": "Test Plunk",
"body": "Testing plunk"
}
Plunk::sendTransactionalEmail($request);
Do feel free to fork this repo and contribute by submitting a pull request. Let's make it better.
I'd love you to star this repo. Also follow me on twitter
The MIT License (MIT). Please see License File for more information.