uiaciel / newsletter
Newsletter Module for SuryaCMS
v1.0.0
2026-04-09 15:17 UTC
Requires
- php: ^8.0
- laravel/framework: ^12.0
Requires (Dev)
- livewire/livewire: ^3.0
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
README
A robust newsletter management system for SuryaCMS (Laravel) that handles subscriptions, email verification, and automated notifications when new posts are published.
🚀 Features
- Double Opt-in Subscription: Secure verification flow with unique tokens.
- Automated Newsletters: Automatically triggers emails to verified subscribers when a post is published.
- Queue Support: Uses Laravel Queues for background email processing to ensure high performance.
- Topic Management: Categorize subscribers into different interest groups (e.g., News, Tutorials).
- Livewire Integration: Ready-to-use
SubscribeFormcomponent. - Admin Dashboard: Manage subscribers and topics easily.
📦 Installation
-
Require the package (if not already autoloaded):
composer require uiaciel/newsletter
-
Run Migrations:
php artisan migrate
-
Configure Queues (Recommended): Set your
.envto use a persistent queue driver:QUEUE_CONNECTION=database
Then run the worker:
php artisan queue:work
🛠Usage
1. Displaying Subscription Form
Add the Livewire component to any Blade view:
<livewire:newsletter.subscribe-form topic="News" />
2. Automated Notifications
The package listens for the PostPublished event from SuryaCMS. When a post status is set to 'Publish', it automatically:
- Fetches all verified subscribers.
- Dispatches
SendNewsletterJobfor each subscriber. - Sends a
NewPostNotificationemail.
3. Manual Email Testing
You can test the email template via Tinker:
use Uiaciel\Newsletter\Mail\NewPostNotification; use Uiaciel\SuryaCms\Models\Post; $post = Post::latest()->first(); Mail::to('user@example.com')->send(new NewPostNotification($post));