Download the PHP package pushpad/pushpad-php without Composer
On this page you can find all versions of the php package pushpad/pushpad-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pushpad/pushpad-php
More information about pushpad/pushpad-php
Files in pushpad/pushpad-php
Package pushpad-php
Short Description Pushpad PHP Library
License MIT
Homepage https://pushpad.xyz
Informations about the package pushpad-php
Pushpad - Web Push Notifications
Pushpad is a service for sending push notifications from websites and web apps. It uses the Push API, which is a standard supported by all major browsers (Chrome, Firefox, Opera, Edge, Safari).
The notifications are delivered in real time even when the users are not on your website and you can target specific users or send bulk notifications.
Installation
Composer
You can install the bindings via Composer. Run the following command:
To use the bindings, use Composer's autoload:
Manual Installation
Download the latest version of this library:
$ git clone https://github.com/pushpad/pushpad-php.git
Then add this line to your application:
Getting started
First you need to sign up to Pushpad and create a project there.
Then set your authentication credentials:
auth_token
can be found in the user account settings.project_id
can be found in the project settings. If your application uses multiple projects, you can pass theproject_id
as a param to methods (e.g.$notification->deliver_to(user_id, array('project_id' => 123))
).
Collecting user subscriptions to push notifications
You can subscribe the users to your notifications using the Javascript SDK, as described in the getting started guide.
If you need to generate the HMAC signature for the uid
you can use this helper:
Sending push notifications
You can set the default values for most fields in the project settings. See also the docs for more information about notification fields.
If you try to send a notification to a user ID, but that user is not subscribed, that ID is simply ignored.
The methods above return an array:
'id'
is the id of the notification on Pushpad'scheduled'
is the estimated reach of the notification (i.e. the number of devices to which the notification will be sent, which can be different from the number of users, since a user may receive notifications on multiple devices)'uids'
(deliver_to
only) are the user IDs that will be actually reached by the notification because they are subscribed to your notifications. For example if you send a notification to['uid1', 'uid2', 'uid3']
, but only'uid1'
is subscribed, you will get['uid1']
in response. Note that if a user has unsubscribed after the last notification sent to him, he may still be reported for one time as subscribed (this is due to the way the W3C Push API works).'send_at'
is present only for scheduled notifications. The fields'scheduled'
and'uids'
are not available in this case.
License
The library is available as open source under the terms of the MIT License.
All versions of pushpad-php with dependencies
ext-curl Version *
ext-json Version *