socieboy/newsletter
Composer 安装命令:
composer require socieboy/newsletter
包简介
MailChimp Subscribers Manager.
README 文档
README
Mailchimp manager.
Configuration
Add the service provider to the provider array on the app.php config file
Socieboy\Newsletter\NewsletterServiceProvider
Execute the command to publish on the config folder the newsletter.php file
php artisan vendor:publish
return [
'lists' => [
'test' => '123123123'
]
];
On the lists key set a name for each list id on mailchimp.
Don't forget to add to your .env file the mailchimp api key.
MAILCHIMP_APIKEY = 00000000000
Usage
Subscribe an email to lists.
On your controller or whatever place where you need to subscribe an email to a list on mailchimp.
<?php namespace App\Http\Controllers;
use Socieboy\Newsletter\Subscriber\SubscriberList as Subscriber;
use App\Http\Requests\Request;
class HomeController extends Controller {
public function index(Request $request, Subscriber $subscriber)
{
$data = $request->only('email');
$subscriber->subscribe('test', $data['email'])
echo 'Done';
}
}
Subscribe to mailchimp "test" list defined on the config file.
Fire campaings
<?php namespace App\Http\Controllers;
use Socieboy\Newsletter\Notifications\Notifier;
use App\Http\Requests\Request;
class HomeController extends Controller {
public function store(Request $request, Notifier $notifier)
{
$data = $request->only(['subject', 'message');
$notifier->notify($data['subject'], $data['message'], 'test')
echo 'Done';
}
}
The message can be a HTML content.
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-28