PushRadar is a realtime notifications API service for the web. The service uses a simple publish-subscribe model, allowing you to broadcast "notifications" on "channels" that are subscribed to by one or more clients. Notifications are pushed in realtime to those clients.
PushRadar features advanced targeting options, including the ability to target clients by actions they have taken on your website or web app, geographical location (countries & continents), IP address, web browser and user ID.
This is PushRadar's official PHP library.
In order to use this library, please ensure that you have the following:
- PHP 5.3.3 or later.
- A PushRadar account - you can sign up at www.pushradar.com.
The easiest way to get up and running is to install the library using Composer. Run the following command in your console:
composer require pushradar/pushradar-php
To begin using the library, create an
index.php file that loads Composer's autoloader from the /vendor folder:
Alternatively, if you do not wish to use Composer, you can download the latest release, and
In order to use this library, please ensure you have enabled the following PHP extensions:
If you are using Composer, it will automatically check whether those extensions are enabled on your system.
"Hello World!" example:
$radar = new \PushRadar\PushRadar("your-secret-key"); $radar->broadcast("test-channel", array("message" => "Hello World!"));
The library supports fluent method chaining to structure broadcasts. For example, to target a notification to website visitors in the US who have not used live chat before:
$radar->targetCountry("US")->targetNotAction("live-chat")->broadcast("test-channel", array( "message" => "Would you like to talk to one of our customer support team members on live chat?"));
Please note that targeting options reset after each call to the
Full documentation for PushRadar's PHP library can be found at: www.pushradar.com/docs/php.