Push notifications in NativePHP for Mobile are powered by Firebase Cloud Messaging (FCM) on both iOS and Android. NativePHP handles the native bits (permissions, token retrieval, firing a Laravel event you can listen to). Your job is to capture and store the device token, then send messages from your server to FCM. This guide walks you through everything with full, drop-in files—no extra SDK required.
A Livewire component that requests push permissions and retrieves the device’s FCM token via NativePHP.
A listener for the TokenGenerated
native event to store the token in your database.
A simple queued job that sends notifications by calling FCM HTTP v1 directly using your Firebase Service Account (minting an OAuth2 access token using plain PHP + Laravel’s HTTP client).
A tiny UI to send yourself a test push.
NativePHP for Mobile targets Laravel 11+ and PHP 8.3+. Add the repo, install, and run the installer.
composer.json (ensure the repository is present)
{
"name": "example/nativephp-push",
"type": "project",
"require": {
"php...