Send a push notification with Thinwrap (PHP)
Send a push notification via the Thinwrap unified Push facade in PHP — same call shape for FCM, APNs, Expo, and every other supported push provider.
1. Install
composer require thinwrap/notifications2. Send the call
use Thinwrap\Notifications\Push;
use Thinwrap\Notifications\Enum\NotificationProviderId;
use Thinwrap\Notifications\Providers\Fcm\FcmConfig;
use Thinwrap\Notifications\DTO\Push\PushSendInput;
// FCM uses RS256 JWT auth — pass the parsed service-account JSON
// (Thinwrap never reads files on your behalf).
$serviceAccount = json_decode(getenv('FCM_SERVICE_ACCOUNT_JSON'), true);
$push = new Push(
NotificationProviderId::Fcm,
new FcmConfig(serviceAccount: $serviceAccount),
);
$result = $push->send(new PushSendInput(
to: 'device-registration-token',
title: 'New message',
body: 'You have a new message waiting',
data: ['conversationId' => '42'],
));
echo $result->status, ' ', $result->providerMessageId ?? '(no id)', PHP_EOL;
Same code works for all supported providers — just change the provider ID.