- How do I install and configure the Pushover package in Laravel?
- Run `composer require by-nativ/pushover`, then add the service provider and facade to `config/app.php`. Configure your Pushover app token and user key in `.env` using `PUSHOVER_API_KEY` and `PUSHOVER_USER_KEY`. Publish the config file if needed with `php artisan vendor:publish`.
- What Laravel versions does this package support?
- The package is officially tested for Laravel 7. For Laravel 8/9, minor adjustments may be needed due to facades auto-discovery changes. Check the GitHub issues for compatibility notes or fork the package for updates.
- How do I send a basic Pushover notification in Laravel?
- Use the facade: `Pushover::push('Title', 'Message')`. Both title and message are required. Optionally, add a URL with `Pushover::url($url, $title)`, a callback with `Pushover::callback($url)`, or a sound with `Pushover::sound('sound_name')`.
- Can I use this package for error alerts or monitoring?
- Yes. Trigger notifications from Laravel events (e.g., `job.failed`) or manually in controllers/commands. For example, log errors to Pushover by catching exceptions and calling `Pushover::push('Error Alert', $exception->getMessage())`.
- What happens if I exceed Pushover’s free tier rate limits (25 messages/hour)?
- The package doesn’t handle retries automatically. For production, consider upgrading to a paid Pushover plan, implementing caching to batch messages, or adding custom retry logic with exponential backoff.
- How do I secure my Pushover API keys in production?
- Store keys in environment variables (`.env`) or a secrets manager like AWS Secrets Manager or HashiCorp Vault. Avoid hardcoding keys in config files or version control. Use Laravel’s `.env` for simplicity in development.
- Are there alternatives to this package for Laravel push notifications?
- Yes. For Pushover, alternatives include `spatie/laravel-pushover` (more actively maintained) or `laravel-notification-channels/pushover`. For other push services, consider Firebase Cloud Messaging (FCM) or Slack notifications via `spatie/laravel-slack-notification-channel`.
- Can I dynamically insert variables (e.g., exception details) into Pushover messages?
- Yes, construct the message string dynamically before passing it to `Pushover::push()`. For example, `Pushover::push('Error in Job', 'Failed: ' . $job->getException()->getMessage())`. Use Laravel’s string helpers like `e()` for escaping if needed.
- How do I test Pushover notifications in my Laravel application?
- Mock the Guzzle HTTP client or use Laravel’s HTTP testing tools to simulate API responses. For example, stub the `Pushover` facade in tests: `Pushover::shouldReceive('push')->once()`. Verify messages by checking logs or a test Pushover user key.
- Does this package support scheduling notifications or delayed delivery?
- No, the package sends notifications immediately. For delayed delivery, queue the notification using Laravel’s queue system (e.g., `dispatch(new PushoverNotification($title, $message))->delay(now()->addMinutes(10))`).