Adityacprtm

Aditya Pratama

DevOps Engi
  • EmailEmail
  • Location Jakarta, ID
Return to Blog

How to Create a Newsletter Subscribers with Laravel

August 9, 2022 · 2 min read

Build a free newsletter system with Laravel to email subscribers when you publish new blog posts.

Adityacprtm
Part of seriesPackages that I use to build my Personal Blog with Laravel

This is my way of how to create or manage an easy and free internal Subscribers Newsletter with Laravel to send email notifications to the subscriber list about new content on the blog.adityacprtm.com site before switching to wordpress.

update: the blog switches to adityacprtm.dev/blog or dev.to/adityacprtm

Another solution is to use a Newsletter Subscription provider such as MailChimp. But if you don’t want to use a third party to store your Subscriber data, you can create your own with laravel using the package from mydnic/laravel-subscribers.

Installation

It is assumed that you have a laravel project ready.

We can use Composer to install, the packages will be installed automatically

codeCopy
composer require mydnic/laravel-subscribers

Then do a publish migration:

codeCopy
php artisan vendor:publish --provider=""Mydnic\Subscribers\SubscribersServiceProvider"" --tag=""subscribers-migrations""

How to Use Newsletter Subscribers

We only need to create a form, then customize it:

codeCopy
<form action=""{{ route('subscribers.store') }}"" method=""post"">
    @csrf
    <input type=""email"" name=""email"">
    <input type=""submit"" value=""submit"">
</form>
@if (session('subscribed'))
    <div class=""alert alert-success"">
        {{ session('subscribed') }}
    </div>
@endif

Unsubscribe or Delete

Just give this link to subscribers:

codeCopy
<a href=""{{ route('subscribers.delete', ['email' => $subscriber->email]) }}"">unsubscribe</a>

This line will generate a link like: /subscribers/delete?email=email@example.com


That’s it! Next, prepare a template for the email.

Explored Topics
Comments
← PreviousHow to Create a Laravel Tagging SystemNext →Easy Ways to Manage Access Control List (ACL) on Linux
© 2026 Aditya Chamim Pratama