dev-master
9999999-devMailChimp Subscribers Manager.
MIT
The Requires
by Francisco Sepulveda
MailChimp Subscribers Manager.
Mailchimp manager., (*1)
Add the service provider to the provider array on the app.php config file, (*2)
Socieboy\Newsletter\NewsletterServiceProvider
Execute the command to publish on the config folder the newsletter.php file, (*3)
php artisan vendor:publish
return [ 'lists' => [ 'test' => '123123123' ] ];
On the lists key set a name for each list id on mailchimp., (*4)
Don't forget to add to your .env file the mailchimp api key., (*5)
MAILCHIMP_APIKEY = 00000000000
On your controller or whatever place where you need to subscribe an email to a list on mailchimp., (*6)
<?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., (*7)
<?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., (*8)
MailChimp Subscribers Manager.
MIT