- Can I use birkof/onesignal-bundle directly in Laravel without Symfony?
- No, this bundle is Symfony-first and requires manual adaptation for Laravel. You’ll need to create a Laravel Service Provider to bridge the bundle’s `OneSignalBundle` or use the underlying `norkunas/onesignal-php-api` library directly to avoid Symfony dependencies.
- How do I configure OneSignal keys in Laravel instead of Symfony’s config.yml?
- Replace Symfony’s `config.yml` with a Laravel config file at `config/onesignal.php`. Define keys like `application_id`, `auth_key`, and `user_auth_key` using Laravel’s `env()` helper for environment variables.
- Does this bundle support Laravel Queues for sending push notifications asynchronously?
- No, the bundle itself doesn’t integrate with Laravel Queues. You’ll need to manually wrap the OneSignal API calls in a Laravel Queue job (e.g., `SendOneSignalNotification`) to avoid blocking HTTP requests.
- What Laravel versions are compatible with birkof/onesignal-bundle?
- Laravel 8.x, 9.x, and 10.x are supported due to PHP 8+ requirements. Laravel 7.x or older is incompatible because the bundle drops PHP 7.x support. Test thoroughly for Symfony dependency conflicts.
- How do I trigger OneSignal notifications from Laravel Events (e.g., user login)?
- Listen to Laravel Events (e.g., `auth.login`) and dispatch a Queue job or call the OneSignal API directly in the event handler. Example: `event(new UserLoggedIn($user));` → Queue job sends push via `OneSignal::send()`.
- Are there Laravel-specific tests or examples for this bundle?
- No, the bundle’s tests are Symfony-focused. For Laravel, refer to the `norkunas/onesignal-php-api` docs or create custom tests wrapping the API in Laravel’s container. Test edge cases like rate limits and error handling.
- Will this bundle conflict with Laravel’s Service Providers or Facades?
- Potential conflicts exist if the bundle assumes Symfony’s `ContainerInterface`. Mitigate by binding the OneSignal API to Laravel’s container manually (e.g., `app['onesignal.api']`) and avoid relying on Symfony’s `Bundle` class.
- What’s the best alternative to this bundle for Laravel push notifications?
- Use `norkunas/onesignal-php-api` directly for a lightweight solution, or explore Laravel-specific packages like `spatie/laravel-onesignal` (if available). These avoid Symfony dependencies entirely.
- How do I handle production errors or rate limits with this bundle?
- Wrap OneSignal API calls in try-catch blocks to log errors (e.g., `OneSignalException`). Implement retries with exponential backoff for rate limits using Laravel’s `retry` helper or a custom service.
- Can I use this bundle with Laravel’s Notification system (e.g., `Notifiable` trait)?
- No, the bundle doesn’t integrate with Laravel Notifications. Create a custom notification channel or extend Laravel’s `Mailable` class to include OneSignal logic, then dispatch via `Notification::send($user, $notification)`.