Introducing Laravel Email on Event

Composer, Laravel Nova, Laravel, Open source

Recently I was working on a Laravel project and I needed to add some sales e-mails: onboarding when someone registers, an e-mail when an order was placed. Those kinds of things.

Now, that can be done easily from within Laravel itself, but you would have to create every e-mail manually. Instead, I wanted to offload this work to the users who create these kinds of e-mails. This project already uses Laravel Nova, so it was an easy choice to use that interface.

Meet Email on Event

I thought this was a really good example to open source, so meet Laravel Nova Email On Event.

This package adds a resource to your Laravel Nova installation. This package scans the available events and lets you create e-mails which will be sent when that specific event occurs.

Events are quite common in an average Laravel installation. Heck, even Laravel has loads of events available. In this first version only your custom events are supported.

Now you can let your end users create powerful e-mails within minutes. This first version also supports the use of variables. You can use the properties that are publicly available on your events. You only have to wrap them in { and }. For example:

Hello {$user->name} # Becomes: Hello John Doe

Installation

Installation is simple. Just open your project and run:

composer require michielgerritsen/laravel-nova-email-on-event

And run migrations:

php artisan migrate

And that's it. When you open Laravel Nova you will see a new tab in your resources list: Email Events. Here you can add new e-mails for each event your application has available. Whether someone signed up for your app or you just shipped an order, an e-mail is quickly added.

Source code

You can find the source code on GitHub. You can also find it on Packagist and NovaPackages.com.

Michiel Gerritsen
About the author

Michiel Gerritsen

Connect on LinkedIn

Founder of Control Alt Delete, a Magento agency specialised in testing, CI/CD and checkout integrations. Working with Magento since 2015, and board member of Mage-OS.

Missing anything?
What are you missing? X
Thank you for your feedback!