uiaciel/newsletter

Newsletter Module for SuryaCMS

Maintainers

Package info

github.com/uiaciel/newsletter

pkg:composer/uiaciel/newsletter

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-09 15:17 UTC

This package is auto-updated.

Last update: 2026-04-09 15:22:58 UTC


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 SubscribeForm component.
  • Admin Dashboard: Manage subscribers and topics easily.

📦 Installation

  1. Require the package (if not already autoloaded):

    composer require uiaciel/newsletter
  2. Run Migrations:

    php artisan migrate
  3. Configure Queues (Recommended): Set your .env to 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:

  1. Fetches all verified subscribers.
  2. Dispatches SendNewsletterJob for each subscriber.
  3. Sends a NewPostNotification email.

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