notifyme / laravel
Official Laravel client for the NotifyMe event → push API
Requires
- php: ^8.2
- illuminate/http: ^11.0|^12.0|^13.0
- illuminate/support: ^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpunit/phpunit: ^11.0|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official Laravel client for NotifyMe — send events from your app and deliver them as iOS push notifications.
Packagist: notifyme/laravel
GitHub: vaporinua-vg/notifyme-laravel
Requirements
- PHP 8.2+
- Laravel 11 / 12 / 13
Install
composer require notifyme/laravel php artisan vendor:publish --tag=notifyme-config
Configure
NOTIFYME_BASE_URL=https://test.upfine.app NOTIFYME_API_KEY=nm_xxxxxxxx NOTIFYME_API_SECRET=nms_xxxxxxxx
Get both values in the NotifyMe dashboard → Project. The secret is shown only once.
Usage
use NotifyMe\Laravel\Facades\NotifyMe; NotifyMe::event('order.paid') ->title('Order paid') ->message('Order #10492 · €248.00') ->image('https://cdn.shop.example/hero.jpg') ->section('Customer', [ ['label' => 'Name', 'value' => 'Alex Morgan'], ], 'person.fill') ->section('Order', [ ['label' => 'Tee', 'value' => 'Heavyweight · L', 'image' => 'https://cdn.shop.example/tee.jpg'], ], 'bag.fill', [ 'https://cdn.shop.example/tee.jpg', 'https://cdn.shop.example/shoes.jpg', ]) ->send();
image() is a picture on the first card (and the inbox thumbnail). section()
appends a titled card — call it once per card, in the order you want them
shown. Pictures must be HTTPS URLs: the 8 KB data cap cannot carry
file bytes, so the app loads them from the URL.
A plain array still works if you already have the JSON:
NotifyMe::event('order.created') ->title('New order') ->message('Order #1234 received') ->priority('high') ->data([ 'order_id' => ['label' => 'Order number', 'value' => 1234], 'amount' => ['label' => 'Total', 'value' => '59€'], ]) ->send();
Or with a plain array:
NotifyMe::send([ 'event' => 'order.created', 'title' => 'New order', 'message' => 'Order #1234 received', 'priority' => 'high', 'data' => [ 'order_id' => 1234, ], ]);
Response (202 Accepted):
[
'success' => true,
'event_id' => '...',
'push_status' => 'queued',
'replayed' => false,
]
202, not 201: NotifyMe stores the event and delivers the push on its own
queue, so your request isn't held open waiting on Apple.
Replayed webhooks
Shopify, Stripe and WooCommerce resend a webhook when they don't get a fast answer. Pass the identifier the source system already has and repeated deliveries collapse into one notification instead of one push per attempt:
NotifyMe::event('order.created') ->title('New order') ->message("Order #{$order->id}") ->idempotencyKey("shopify-order-{$order->id}") ->send();
A replay answers 200 with 'replayed' => true. Keys are scoped per project.
Retries and errors
Connection failures, 429 and 5xx are retried automatically (3 attempts,
200 ms apart by default). Rejected credentials and validation errors fail
immediately, because repeating them changes nothing.
NOTIFYME_TIMEOUT=10 NOTIFYME_RETRIES=3 NOTIFYME_RETRY_DELAY=200
Everything that still fails throws NotifyMe\Laravel\Exceptions\NotifyMeException,
carrying ->status and ->responseBody:
use NotifyMe\Laravel\Exceptions\NotifyMeException; try { NotifyMe::event('order.created')->title('New order')->message('...')->send(); } catch (NotifyMeException $e) { report($e); // $e->status, $e->responseBody }
Sending from a queued job is still a good idea — it keeps a NotifyMe outage from failing the request that triggered it.
Tests
composer install vendor/bin/phpunit
Security
- Never put
NOTIFYME_API_SECRETin the frontend or git. - Use server-side code only (jobs, listeners, controllers).
- Rotate credentials in the dashboard if leaked.
Auth headers (what the package sends)
Authorization: Bearer <api_key>
X-NotifyMe-Secret: <api_secret>
Content-Type: application/json
License
MIT