1. Go to this page and download the library: Download pushpad/pushpad-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
pushpad / pushpad-php example snippets
Pushpad\Pushpad::$authToken = '5374d7dfeffa2eb49965624ba7596a09';
Pushpad\Pushpad::$projectId = 123; // set a default project (optional)
// Notification ID
$notificationId = $response['id'];
// Estimated number of devices that will receive the notification
// Not available for notifications that use send_at
$estimatedReach = $response['scheduled'];
// Available only if you specify some user IDs (uids) in the request:
// it indicates which of those users are subscribed to notifications.
// Not available for notifications that use send_at
$reachedUids = $response['uids'];
// The time when the notification will be sent.
// Available for notifications that use send_at
$scheduledAt = $response['send_at'];
$notification = Pushpad\Notification::find(42);
echo $notification->title; // "Foo Bar"
echo $notification->target_url; // "https://example.com"
echo $notification->ttl; // 604800
echo $notification->created_at; // ISO 8601 string
echo $notification->successfully_sent_count; // 4
echo $notification->opened_count; // 2
// ... and many other attributes
print_r($notification->toArray());
Pushpad\Notification::create([
'body' => 'This notification will be sent after 60 seconds',
'send_at' => (new DateTimeImmutable('+60 seconds'))->format(DATE_ATOM),
]);