riverskies/laravel-newsletter-subscription
Composer 安装命令:
composer require riverskies/laravel-newsletter-subscription
包简介
Simple newsletter subscription for Laravel projects.
README 文档
README
A simple package to enable newsletter subscriptions within the context of a Laravel application.
Installation
$ composer require riverskies/laravel-newsletter-subscription
Laravel 5.4 or earlier
Add the service provider to your config/app.php file:
'providers' => [ // ... Riverskies\LaravelNewsletterSubscription\Providers\NewsletterSubscriptionServiceProvider::class, ];
Usage
Include a simple form anywhere within your pages.
<form action="/subscribe" method="POST"> {{ csrf_field() }} <input type="email" name="email"/> <button type="submit">Subscribe</button> </form>
You might also want to include notification display on the same page.
@if(session('flash'))
<p>{{ session('flash') }}</p>
@endif
Subscriptions
This package collects email addresses and stores them in the database. You can access these subscriptions by querying the Riverskies\LaravelNewsletterSubscription\NewsletterSubscription Eloquent model.
Note
This package uses the Mail facade to deliver the emails and delivery is queued, so ensure your QUEUE_DRIVER in your environment config is set accordingly.
Publishing assets
You can override the database table name, the associated URLs, email template format and the session key by overriding the default configuration values.
$ php artisan vendor:publish --tag='newsletter-subscription-config'
You can design the confirmation email by overriding the default view.
$ php artisan vendor:publish --tag='newsletter-subscription-views'
You can localise/change the messages by overriding the default localisation values.
$ php artisan vendor:publish --tag='newsletter-subscription-translations'
Considerations
This package uses hashids/hashids to help derive unsubscribe links from the id fields of the subscription records. Those hashes are not stored in the database but instead encoded/decoded at runtime. To generate unique codes, this package uses the APP_KEY from the environment settings. If that changes, previously generated unsubscribe links will no longer work.
Contributions
PRs are welcome as long as they are following PSR-2 standards and include all the corresponding tests that the change requires (not to mention that those should not break any previous behaviour either).
riverskies/laravel-newsletter-subscription 适用场景与选型建议
riverskies/laravel-newsletter-subscription 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.3k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2017 年 09 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 riverskies/laravel-newsletter-subscription 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 riverskies/laravel-newsletter-subscription 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-06