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.
Pros:
Newsletter::subscribe()) that abstracts provider-specific complexities.subscribeOrUpdate and delete suggest extensibility for hooks (e.g., triggering analytics or user notifications).NullDriver and LogDriver.Cons:
MailChimpDriver) requires its own SDK (e.g., drewm/mailchimp-api), adding dependency complexity.hasMember() checks).spatie/mailcoach-sdk-php and UUID-based list IDs.drewm/mailchimp-api and list IDs from the UI.mailerlite/mailerlite-php and group IDs.env() conventions.drewm/mailchimp-api) may introduce breaking changes (e.g., API deprecations).NullDriver or LogDriver be used for CI/CD testing, or is a mock provider needed?Facade pattern (e.g., Newsletter::subscribe()).config/newsletter.php for provider-specific settings.spatie/mailcoach-sdk-php (maintained by the same team).drewm/mailchimp-api (community-driven, but stable).mailerlite/mailerlite-php (official SDK).Newsletter::dispatchSync()).getMember().Newsletter::getApi()->getLastError()).AppServiceProvider.composer require spatie/laravel-newsletter drewm/mailchimp-api mailerlite/mailerlite-php
NEWSLETTER_API_KEY, NEWSLETTER_LIST_ID).Newsletter::subscribe($email)).Newsletter::getApi()->getLastError()).NullDriver for unit tests; mock the facade for integration tests.getLastError() or Laravel’s logging.drewm/mailchimp-api) may require testing.composer.json to avoid surprises.NullDriver for graceful degradation during outages.LogDriver and getLastError() simplify troubleshooting.Newsletter::dispatchSync()).How can I help you explore Laravel packages today?