Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Newsletter

Laravel Newsletter Laravel Package

spatie/laravel-newsletter

Laravel package to manage newsletter subscriptions across providers. Supports Mailcoach, MailChimp, and MailerLite, with a unified API for subscribing/unsubscribing and list management. Includes configurable integration via config/newsletter.php.

View on GitHub
Deep Wiki
Context7

Manage Mailcoach, MailChimp and MailerLite newsletters in Laravel

Frequently asked questions about Laravel Newsletter
How do I install and set up spatie/laravel-newsletter for MailerLite?
Run `composer require spatie/laravel-newsletter`, then publish the config with `php artisan vendor:publish --tag=newsletter-config`. Configure your MailerLite API key and default group ID in `config/newsletter.php` under the `mailerlite` section. No migrations are needed—just start subscribing users via `Newsletter::subscribe()`.
Can I use this package with Laravel 10+? What versions are supported?
Yes, the package is fully compatible with Laravel 10 and 11. It also supports Laravel 9 and 8. Check the [GitHub releases](https://github.com/spatie/laravel-newsletter/releases) for version-specific requirements. Always test in a staging environment before upgrading.
How do I switch from Mailchimp to MailerLite without breaking my app?
Update the `default` driver in `config/newsletter.php` to `mailerlite`. The package’s unified API ensures no changes to your subscription logic are needed. Run `Newsletter::syncLists()` to migrate existing subscribers if required, or use the provider’s native tools for bulk migration.
Does this package support webhooks for MailerLite? How do I set them up?
Yes, MailerLite webhooks (e.g., `subscriber:created`) can be mapped to Laravel events. Use the `Webhook` class to validate signatures and dispatch events like `NewsletterSubscribed`. Configure the webhook URL in `config/newsletter.php` under `mailerlite.webhook_url`.
How do I handle custom fields (tags, attributes) for MailerLite subscribers?
MailerLite supports custom fields via the `merge_fields` or `custom_fields` parameters in the `subscribe()` method. Pass an array like `['custom_fields' => ['field1' => 'value1']]` to the method. Test field mappings early, as MailerLite’s API may differ from Mailchimp’s.
What’s the best way to test newsletter subscriptions in Laravel?
Use Laravel’s mocking to test interactions with the Newsletter facade. Example: `$this->mock(Newsletter::class)->shouldReceive('subscribe')->once()`. For MailerLite-specific tests, mock the `MailerLite` service directly. Integration tests should verify webhook signatures and API responses.
Will this package work with Laravel queues for async newsletter operations?
Yes, all subscription/unsubscription operations are queueable by default. Use `Newsletter::subscribe($email)->onQueue('newsletters')` to offload work. For heavy loads, optimize batching or retry logic in the `MailerLite` driver’s API calls.
How do I handle rate limits or API errors from MailerLite?
The package automatically retries failed API calls with exponential backoff. For rate limits, configure `mailerlite.api_timeout` in the config or implement custom retry logic in a service provider. Monitor MailerLite’s [status page](https://mailerlite.com/status) for outages.
Can I use this package for both marketing and transactional emails?
Yes, but evaluate MailerLite’s feature parity for transactional use cases (e.g., automation, segmentation). The package supports multi-provider setups—route subscribers to MailerLite for marketing and another provider for transactions by checking the `default` driver in your config.
Are there alternatives to this package for Laravel newsletter management?
Alternatives include `spatie/laravel-mailcoach` (for Mailcoach-only apps), `spatie/laravel-activitylog` (for tracking subscriptions), or provider-specific SDKs like `mailerlite/mailerlite`. This package stands out for its unified API, multi-provider support, and Laravel-native integration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai