by-nativ/pushover
Laravel 5 package for sending push notifications via Pushover.net to iOS and Android. Provides a simple facade to push messages with optional title, URL, callback, and sound, using your Pushover app token and user key configuration.
Installation
composer require by-nativ/pushover
Publish the config file:
php artisan vendor:publish --provider="ByNativ\Pushover\PushoverServiceProvider"
Configuration
Edit .env with your Pushover API token and user key:
PUSHOVER_TOKEN=your_app_token
PUSHOVER_USER_KEY=your_user_key
First Use Case Send a basic notification in a controller or command:
use ByNativ\Pushover\Pushover;
public function sendNotification()
{
Pushover::send('Hello from Laravel!');
}
Basic Notifications
Pushover::send('Message', [
'title' => 'Alert',
'priority' => 1, // 0-2 (lowest to highest)
]);
Attachments
Pushover::send('Check this out!', [
'attachment' => [
'url' => 'https://example.com/image.png',
'content_type' => 'image/png',
],
]);
Conditional Sending
if (config('app.debug_mode')) {
Pushover::send('Debug alert!', ['priority' => 2]);
}
Queueing Notifications
Pushover::queue('Scheduled alert', ['priority' => 1]);
try {
Pushover::send('Message');
} catch (\Exception $e) {
\Log::error('Pushover failed: ' . $e->getMessage());
}
.env values per environment (e.g., PUSHOVER_TOKEN_STAGING).'defaults' => [
'priority' => 0,
'retry' => 30,
],
Pushover::queue('High-volume alert');
'strict' => true,
$response = Pushover::send('Test', [], true); // Enable debug mode
\Log::debug($response);
401: Invalid token/user key.400: Malformed request (e.g., missing message).config/pushover.php:
'client' => \Illuminate\Support\Facades\Http::macro('override', function () {
return new \GuzzleHttp\Client(['timeout' => 10]);
}),
event(new \App\Events\DeploymentFailed);
// In listener:
Pushover::send('Deployment failed!');
$users = User::where('notifications_enabled', true)->get();
foreach ($users as $user) {
Pushover::send('Alert', [], $user->pushover_key);
}
How can I help you explore Laravel packages today?