stellarsecurity / notification-laravel
Laravel client for Stellar Notification API
Package info
github.com/StellarSecurity-Packages/stellarsecurity-notification-laravel
pkg:composer/stellarsecurity/notification-laravel
Requires
- php: ^8.2
- illuminate/http: ^11.0 || ^12.0
- illuminate/support: ^11.0 || ^12.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is not auto-updated.
Last update: 2026-09-10 22:48:38 UTC
README
A lightweight Laravel package for sending events to the Stellar Notification API.
Install
composer require stellarsecurity/notification-laravel
Publish config
php artisan vendor:publish --tag=stellar-notifications-config
Configure
In your .env:
STELLAR_NOTIFICATIONS_BASE_URL=https://your-notifications-api.example STELLAR_NOTIFICATIONS_BASIC_USERNAME=your-basic-username STELLAR_NOTIFICATIONS_BASIC_PASSWORD=your-basic-password STELLAR_NOTIFICATIONS_SERVICE_TOKEN=your-internal-service-token
Optional HTTP settings. These defaults are already built into the package, even if you do not publish config:
STELLAR_NOTIFICATIONS_TIMEOUT=30 STELLAR_NOTIFICATIONS_CONNECT_TIMEOUT=10 STELLAR_NOTIFICATIONS_RETRY_TIMES=5 STELLAR_NOTIFICATIONS_RETRY_SLEEP_MS=1000 STELLAR_NOTIFICATIONS_RETRY_MULTIPLIER=2 STELLAR_NOTIFICATIONS_RETRY_MAX_SLEEP_MS=10000
Retry is applied to transient failures:
- connection timeouts / connection errors
- 408 Request Timeout
- 429 Too Many Requests
- 500 Internal Server Error
- 502 Bad Gateway
- 503 Service Unavailable
- 504 Gateway Timeout
With the defaults, retry backoff is:
1s -> 2s -> 4s -> 8s -> 10s max
Each request attempt can use up to 10 seconds to connect and 30 seconds total request time.
Usage
use StellarSecurity\Notifications\DTO\NotificationEvent; use Notification; Notification::send( NotificationEvent::make('welcome') ->product('stellar-antivirus') ->email($user->email) ->userRef((string) $user->id) ->payload(['app_name' => 'Stellar Antivirus']) ->idempotencyKey('welcome-'.$user->id) );
Native push notifications
Device registrations and push sends use the internal bearer credential. Raw device tokens are sent only to the Notification API and must not be logged or stored by the consuming application.
use StellarSecurity\Notifications\DTO\PushNotification; use StellarSecurity\Notifications\DTO\PushSubscriptionRegistration; use StellarSecurity\Notifications\StellarNotificationClient; $client = app(StellarNotificationClient::class); $subscriptionId = $client->registerPushSubscription( new PushSubscriptionRegistration( application: 'stellar-esim', platform: 'ios', token: $deviceToken, externalReference: $anonymousChatId, ), ); $client->sendPushNotification($subscriptionId, new PushNotification( dedupeKey: 'support-message:'.$messageId, title: 'Stellar Support replied', body: 'Tap to view the conversation.', data: ['type' => 'support_chat_reply', 'session_id' => $anonymousChatId], ));