A Laravel 12 implementation of the Adapter Design Pattern for a unified notification delivery system.
- Adapter Pattern: Demonstrates how adapters can unify different notification channels under a single interface
- Extensibility: Easy addition of new notification channels through adapter implementation
- Service Integration: Seamless integration with email, SMS, and other notification services
- Laravel Integration: Utilizes Laravel's dependency injection and service container features
- App\Services\Notifications\BaseNotificationService: Abstract base service with common functionality
- App\Services\Notifications\Adapters: Contains channel-specific adapters (EmailAdapter, SMSAdapter)
- App\Services\Notifications\Factory: Creates appropriate adapters based on configuration
- App\Models\NotificationLog: Tracks notification delivery and status
- App\Models\NotificationTemplate: Manages reusable notification templates
- Unified notification API
- Multiple delivery channels
- Template management
- Delivery tracking
- Channel validation
- Clone repository:
git clone https://github.com/klejvi-ajdini/laravel-notify-hub.git
cd laravel-notify-hub
- Install dependencies:
composer install
npm install && npm run dev
- Environment setup:
cp .env.example .env
php artisan key:generate
php artisan migrate
- Configure services in
.env
:
MAIL_MAILER=smtp
DEFAULT_NOTIFICATION_CHANNEL=email
- Start server:
php artisan serve
Run tests:
php artisan test
- Fork repository
- Create feature branch
- Submit pull request
MIT License