- How do I install and set up jeffersongoncalves/laravel-newsletter?
- Install it with Composer using composer require jeffersongoncalves/laravel-newsletter, then publish the package's migrations, config, and Blade views with php artisan vendor:publish. Run php artisan migrate to create the subscribers table, and clear your route, config, and view caches so the package's routes and views resolve correctly. No adapter code is needed in a standard Laravel application, and the workflow is only a few artisan commands.
- Which Laravel versions does laravel-newsletter support?
- The package follows Laravel-native conventions such as service provider boot() route registration and Route::middleware('web')->group(...), which places it in the Laravel 10/11 era. Before adopting it, check the illuminate/support constraint in its composer.json against the Laravel version you have pinned in your application. Because the package ships routes, config, and views rather than an API layer, it targets conventional Blade-rendered Laravel apps rather than stateless setups.
- How does double opt-in confirmation work in this package?
- When someone subscribes, the package stores them as a pending subscriber and sends a confirmation email containing a signed confirmation link. Clicking that link hits the package's confirm route, which validates the signature and marks the subscriber as confirmed. All of this is driven through configurable routes, views, and notifications, so you can adjust the messaging and redirects without touching the package source.
- Why am I getting a 419 Page Expired error on the newsletter subscribe route?
- Version 2.0.1 registers the package's public routes under Laravel's web middleware group, which enables CSRF verification on the subscribe POST. That is the correct default for a server-rendered Blade form, but any custom frontend, headless or SPA consumer, cached page, or embedded third-party form will now receive a 419 unless it supplies a valid CSRF token. Non-Blade consumers need to include the token in the request or add an exemption for the package's route path in VerifyCsrfToken.
- Are the unsubscribe links in laravel-newsletter secure?
- Yes. Unsubscribes use signed links, so the signature is validated before any subscriber record is changed, which prevents tampering or unsubscribing someone by guessing an ID. Recipients do not need an account or login, which keeps the flow frictionless for mailing list compliance. The signature is tied to the URL, so you should avoid rewriting or re-hosting those links through a third party that strips query parameters.
- Can I customize the subscriber model, routes, views, and config in laravel-newsletter?
- Yes. The package ships publishable config, migrations, routes, and Blade views, and it lets you swap in your own subscriber model through configuration. That means you can extend the model, change route prefixes or middleware, and restyle the subscribe and confirm pages without forking the package. If you published and customized the 2.0.0 subscribe form assets, re-publish the views after updating so you do not carry stale markup forward.
- Does laravel-newsletter fire events or send notifications for subscription changes?
- The package dispatches events and notifications for subscription changes, so you can hook into confirmations, unsubscribes, and new sign-ups from your own listeners. It leans on Laravel-native queues and mail, which means you can queue the outgoing mail and keep the subscribe request fast. Validation and localization also follow Laravel's built-in mechanisms, so existing language files and form request patterns carry over.
- Is laravel-newsletter safe to use in production?
- Version 2.0.0 shipped a fatal ErrorException on requests to the new subscribe form, which was the package's primary conversion path; 2.0.1 fixes it by moving public routes into the web middleware group. Treat 2.0.x as a young major line and pin versions in composer.json rather than floating to the latest tag. Also note that running the track (open pixel) and webview routes under web middleware starts a session and sets cookies, which has CDN caching and privacy-consent implications worth reviewing for EU recipients.
- How do I upgrade from 1.x or 2.0.0 to 2.0.1?
- From 2.0.0 it is a mandatory but low-risk patch: run composer update for the package, then execute php artisan route:clear, php artisan config:clear, and php artisan view:clear, since stale cached routes are the most common reason the fix appears not to apply. Confirm the change with php artisan route:list --path=<your-package-prefix> and check that the web middleware column is populated. From 1.x, stop and read the 2.0.0 changelog first, because breaking changes to config keys, published view paths, notification classes, or database columns are not fully documented in the package overview.
- How does laravel-newsletter compare to hosted newsletter services or other Laravel subscriber packages?
- This package keeps subscriber data in your own database and focuses on the subscription lifecycle: storing subscribers, double opt-in confirmation, signed unsubscribes, and events you can hook into for delivery. Hosted services such as Mailchimp or ConvertKit handle list hosting, deliverability, and compliance reporting for you, which is a different trade-off than self-managed storage. If you only need to store emails and send campaigns through Laravel's mailer, a lightweight in-app package like this keeps everything inside your existing application and infrastructure.