/laravel-plunk

Laravel Package for integrating Plunk seamlessly

Primary LanguagePHPMIT LicenseMIT

laravel-plunk

Issues Forks Stars

A laravel package to easily integrate plunk

Installation

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.

Usage

1. Update your environment file with your secret key as described below.

PLUNK_SECRET_KEY="<SECRET_KEY>"

Login to your Plunk dashboard to obtain your secret key.

2. Make a call to the method you need.

use Toyosi12\Plunk\Facades\Plunk;
Plunk::countContacts();

References

Events

  • 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);

Emails

  • 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);

Contributing

Do feel free to fork this repo and contribute by submitting a pull request. Let's make it better.

Star

I'd love you to star this repo. Also follow me on twitter

License

The MIT License (MIT). Please see License File for more information.