liran-co/laravel-notification-subscriptions
Laravel Notification Subscriptions adds flexible, database-backed notification preferences to your app. Let users subscribe or unsubscribe from specific notification types and channels, with polymorphic subscribers, simple traits, and clean APIs for checking and managing subscriptions.
Architecture fit: The package is a Laravel service provider that likely adds a trait, config, migration, and an integration point (probably a NotificationSending event listener) to enforce subscriptions before notifications are sent. This aligns with Laravel’s modular architecture and avoids core hacks. It fits a standard Laravel monolith or modular monolith. However, if the integration overrides the notification sender or channel manager, it could conflict with other packages; verify.
Integration feasibility: Feasible. Requires Composer install, publishing assets, running migrations, adding a trait to the Notifiable model (e.g., User), and building a UI/API for users to manage preferences. Backend integration is low-code; the main effort is UX and default subscription logic. Works with queued notifications if the listener runs in the worker. Need to confirm support for multiple notifiable models and guards.
Technical risk: High due to low adoption (127 stars, 0 dependents), single maintainer, and limited community validation. Last release April 2024 is recent but activity may be sporadic. Code quality, test coverage, and security posture are unknown. Potential risks: abandoned package, Laravel version lock, performance overhead of per-notification DB checks, incomplete handling of anonymous notifiables, and lack of multi-tenancy support. MIT license mitigates lock-in via forking.
Key questions:
Stack fit: Good fit for Laravel 9/10/11 applications using standard notifications. Requires PHP 8.1+ (verify). Works with MySQL/Postgres/SQLite. If the app uses Filament/Nova, a custom UI is needed. Compatible with queue workers if integration is event-based. Check for conflicts with other notification-preference packages.
Migration path:
User (and other notifiables if needed).Compatibility: Verify Laravel version constraints (likely ^9.0|^10.0|^11.0), PHP version, and database support. Check if it uses JSON columns or specific SQL features. Test with the app’s notification classes and channels (mail, database, broadcast, SMS). Ensure it doesn’t conflict with custom notification channels or Notification::route usage. Check support for anonymous notifiables and multiple guards.
Sequencing: Start with a time-boxed spike (2-3 days) to audit and prototype. Then integrate backend (trait, migration, event listener) in week 1. Build UI and backfill in week 2. Test edge cases (queued, anonymous, multi-tenant) in week 2-3. Deploy behind a feature flag. Monitor for missed/unwanted notifications.
Maintenance: Low community activity and single maintainer mean we should plan to own the package. Budget for periodic code review, dependency updates, and potential fork. MIT license allows internal fork; keep a vendor branch. Estimate 0.1 FTE ongoing. Watch for Laravel major version upgrades.
Support: No commercial support. GitHub issues may be slow. Internal documentation and runbooks are essential. Identify a package owner. If critical, consider forking and maintaining internally.
Scaling: Subscription checks add a DB query per notification send. At high volume, cache subscriptions per user (Redis) and invalidate on change. Table size grows with users × notification types × channels; add composite indexes and consider archiving. For batch notifications, preload subscriptions. Monitor query latency and cache hit rate.
Failure modes:
Ramp-up: Low for Laravel developers familiar with notifications. Trait and config are straightforward. Main learning is the integration point and edge cases (queued, anonymous, multi-guard). UI work is standard. Estimate 1-2 developer-weeks for MVP including audit, integration, UI, backfill, and tests. Add 2-3 days for caching and performance tuning if high volume.
How can I help you explore Laravel packages today?