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::$auth_token = '5374d7dfeffa2eb49965624ba7596a09';
Pushpad\Pushpad::$project_id = 123; # set it here or pass it as a param to methods later
Pushpad\Pushpad::signature_for($current_user_id);
$notification = new Pushpad\Notification(array(
# e of the notification (defaults to your project name)
'title' => "Website Name",
# optional, open this link on notification click (defaults to your project website)
'target_url' => "https://example.com",
# optional, the icon of the notification (defaults to the project icon)
'icon_url' => "https://example.com/assets/icon.png",
# optional, the small icon displayed in the status bar (defaults to the project badge)
'badge_url' => "https://example.com/assets/badge.png",
# optional, an image to display in the notification content
# see https://pushpad.xyz/docs/sending_images
'image_url' => "https://example.com/assets/image.png",
# optional, drop the notification after this number of seconds if a device is offline
'ttl' => 604800,
# optional, prevent Chrome on desktop from automatically closing the notification after a few seconds
' https://pushpad.xyz/docs/schedule_notifications
'send_at' => strtotime('2016-07-25 10:09'), # use a function like strtotime or time that returns a Unix timestamp
# optional, add the notification to custom categories for stats aggregation
# see https://pushpad.xyz/docs/monitoring
'custom_metrics' => array('examples', 'another_metric') # up to 3 metrics per notification
));
# deliver to a user
$notification->deliver_to($user_id);
# deliver to a group of users
$notification->deliver_to($user_ids);
# deliver to some users only if they have a given preference
# e.g. only $users who have a interested in "events" will be reached
$notification->deliver_to($users, ["tags" => ["events"]]);
# deliver to segments
# e.g. any subscriber that has the tag "segment1" OR "segment2"
$notification->broadcast(["tags" => ["segment1", "segment2"]]);
# you can use boolean expressions
# they can
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.