uiaciel/newsletter
最新稳定版本:v1.0.2
Composer 安装命令:
composer require uiaciel/newsletter
包简介
Newsletter Module for SuryaCMS
README 文档
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));
统计信息
- 总下载量: 5
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-09