Laravel Expo Notification Channel
Expo push-notification channel for delivering notifications to React Native apps from Laravel.
Repository Health
Technical Analysis
Laravel Expo Notification Channel is a driver for Laravel’s notification system that sends push notifications through Expo’s push service to React Native applications. It plugs into the framework’s Notification classes so you can deliver mobile push messages the same way you send mail or database notifications.
The package provides a typed ExpoMessage builder, an ExpoPushToken value object with validation rules and an Eloquent cast, and a Guzzle-backed gateway that talks to the Expo API, including optional access-token security and delivery-receipt handling.
What You Get
- An
ExpoChannelthat integrates with Laravel’s notification system via atoExpomethod - A fluent, typed
ExpoMessagebuilder for titles, bodies, data, sound, badges, and priority - An
ExpoPushTokenvalue object with a validation rule and an Eloquent cast - A Guzzle-based gateway with optional Expo access-token security and gzip payload compression
- Delivery-receipt retrieval and a
ExpoNotificationSentevent
Common Use Cases
- Sending push notifications to a React Native app built with Expo
- Notifying mobile users of events alongside mail and database channels
- Validating and storing Expo push tokens on user models
- Tracking push delivery via Expo receipts
Under The Hood
Architecture - src/ExpoServiceProvider.php registers the driver so Laravel’s notification manager resolves an expo channel to src/ExpoChannel.php. The channel pulls an ExpoMessage (a typed builder) and the recipient’s ExpoPushToken, then hands an ExpoEnvelope to a Gateway/ExpoGateway implementation (ExpoGatewayUsingGuzzle) that POSTs to Expo’s push API and parses an ExpoResponse/ExpoError. Tokens are validated via Validation/ExpoPushTokenRule and can be stored through the Casts/AsExpoPushToken Eloquent cast; delivery emits an Events/ExpoNotificationSent event.
Tech Stack - PHP 8.3+, GuzzleHttp 7 for transport, and the illuminate/notifications, illuminate/contracts, and illuminate/support components (Laravel 12/13). Optional ext-zlib enables gzip compression of payloads over 1 KiB.
Code Quality - The project is strongly typed and well-tested, using Larastan (level static analysis), Laravel Pint, and a PHPUnit suite via Orchestra Testbench. Value objects and dedicated exception types (CouldNotSendNotification, CouldNotGetReceipts) make failures explicit.
API Design - Usage follows Laravel’s notification idioms exactly: implement toExpo() returning a fluent ExpoMessage, expose a routeNotificationForExpo() on the notifiable, and the channel handles batching and transport. The abstractions are clean and require minimal boilerplate.