laravel-notification-channels/pushbullet
Laravel notification channel for Pushbullet. Send push notifications to devices, contacts, and channels through Laravel’s notification system, with support for titles, bodies, links, and optional attachments. Simple setup and a clean API.
composer require laravel-notification-channels/pushbullet. The service provider is auto-discovered, so there is nothing to register in config/app.php..env:
PUSHBULLET_ACCESS_TOKEN=your-token
Then wire it into config/services.php:
'pushbullet' => [
'access_token' => env('PUSHBULLET_ACCESS_TOKEN'),
],
src/PushbulletChannel.php and src/PushbulletMessage.php — the README is short, and those two classes define the entire public surface (message builders, routing expectations, and the HTTP call).PushbulletChannel::class from via(), implement toPushbullet(), and add routeNotificationForPushbullet() on your notifiable model returning the destination (an account email or a device iden):
public function via($notifiable) { return [PushbulletChannel::class]; }
public function toPushbullet($notifiable)
{
return PushbulletMessage::create()
->title('Deploy finished')
->body('production @ '.now());
}
Then trigger it like any other notification: $user->notify(new DeployFinished());PushbulletChannel::class to notifications that already fan out to email or Slack, so push notifications become an additive alert path rather than a replacement.routeNotificationForPushbullet() to your User model returning a device iden or email — usually stored as a nullable pushbullet_iden column. Return null/empty when the user has not connected a device and check before dispatching, since a missing route typically fails at send time, not at boot.PushbulletMessage::create() with ->title(), ->body(), and ->link() covers the "note" and "link" pushes you'll send 95% of the time. Keep message construction inside toPushbullet(); it maps cleanly to the API payload and keeps notifications testable.ShouldQueue on notification classes that use this channel. The channel makes a synchronous HTTP call; queueing isolates your request cycle from Pushbullet latency and gives you retry/backoff for free.Event/Schedule system in Kernel or a listener rather than scattering notify() calls.Notification::fake(). Assert with assertSentTo($user, DeployFinished::class). If you need to test the channel itself, wrap the Pushbullet client behind a small interface and bind a fake, or Http::fake() if the channel uses Laravel's HTTP client — this is the only way to exercise payloads without hitting the real API.notifyViaPushbullet() helper or a dedicated PushbulletAlert notification on the notifiable so the routing rule (device iden vs. email, opt-out flag) lives in one place.composer.json constraints against your Laravel/PHP/Guzzle versions and run the existing tests. If it won't install cleanly, plan to fork or vendor the two source files.services.pushbullet.access_token. A missing token usually manifests as an API error at send time, not a boot error — so cache-clear and sanity-check config('services.pushbullet.access_token') first when pushes silently fail.email, device_iden, channel_tag, and client_iden. Whatever routeNotificationForPushbullet() returns must map to the parameter the package sends; returning a full user object or an array of identifiers will produce a 400. Return a single string identifier.notify() in a try/catch where a missed alert shouldn't break the request.Pushbullet PHP client or raw HTTP calls in a custom channel rather than fighting this one.PushbulletMessage before dispatch, and enable Guzzle/Laravel HTTP logging on the channel to see the actual request body and API response. The response body from Pushbullet is descriptive enough to pinpoint identifier vs. token vs. quota problems.PushbulletChannel to add logging, retries, or metrics, and subclass PushbulletMessage to add a builder method for a payload field the package doesn't expose. Keep the subclassed channel registered via via() so nothing else changes.How can I help you explore Laravel packages today?