symfony/firebase-notifier
Symfony Notifier bridge for Firebase Cloud Messaging. Configure via FIREBASE_DSN and send notifications with platform-specific options using AndroidNotification, IOSNotification, or WebNotification to customize icons, sounds, actions, and more.
Pros:
AndroidNotification, IOSNotification, and WebNotification classes, enhancing user experience.FIREBASE_DSN=firebase://USERNAME:PASSWORD@default) aligns with Laravel’s .env configuration paradigm, simplifying credential management.Cons:
Illuminate\Bus\Dispatcher or Illuminate\Queue).Laravel Stack Fit:
ChatterInterface to Laravel’s Bus or Events systems.Chatter and Transport classes within Laravel’s service container using Laravel’s bind() method in a service provider.spatie/laravel-ignition, laravel-websockets) due to overlapping or conflicting Symfony dependencies.Illuminate\Queue).Migration Path:
Chatter to align with Laravel’s event/queue patterns.Bus or Events to trigger Symfony Notifier messages.Compatibility:
laravel-notifier) may arise.High:
Medium:
AndroidNotification/IOSNotification classes require manual validation to prevent malformed payloads from reaching Firebase.FailedJob events).Low:
.env conventions.Symfony vs. Laravel Prioritization:
matthiasmullie/laravel-fcm (HTTP v1 API) or pusher/laravel-echo.PHP Version Compatibility:
Firebase API Strategy:
Integration Depth:
Chatter is integrated (e.g., as a command, observer, or service).bus:dispatch or event:dispatch in Laravel?Failure and Retry Logic:
Illuminate\Queue\FailedJob to log or retry Firebase-specific failures.Analytics and Monitoring:
Long-Term Maintenance:
Laravel Compatibility:
ChatterInterface to a Laravel-compatible implementation (e.g., a decorator or facade).use Symfony\Component\Notifier\ChatterInterface;
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\Bridge\Firebase\Transport\FirebaseTransportFactory;
class FirebaseNotifierServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton(ChatterInterface::class, function ($app) {
$notifier = new Notifier([
new FirebaseTransportFactory(env('FIREBASE_DSN')),
]);
return $notifier->chatter();
});
}
}
event:dispatch or bus:dispatch. Example:
use Illuminate\Support\Facades\Bus;
Bus::dispatch(new SendNotification(
new ChatMessage('Hello!'),
new AndroidNotification('/topics/news', [])->icon('myicon')
));
Dependency Management:
replace or conflict directives to resolve Symfony dependency conflicts with Laravel packages.composer.json:
"replace": {
"symfony/messenger": "self.version",
"symfony/notifier": "self.version"
}
provider and alias mechanisms to isolate Symfony dependencies.Firebase Credential Handling:
.env:
FIREBASE_DSN=firebase://USERNAME:PASSWORD@default
config() helper to access credentialsHow can I help you explore Laravel packages today?