Download the PHP package gidix/pushnotifier-php without Composer
On this page you can find all versions of the php package gidix/pushnotifier-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gidix/pushnotifier-php
More information about gidix/pushnotifier-php
Files in gidix/pushnotifier-php
Package pushnotifier-php
Short Description PushNotifier library for PHP
License proprietary
Informations about the package pushnotifier-php
PushNotifier (v2) for PHP
A pretty convenient library to use PushNotifier in PHP projects.
Installation
Add this to composer.json
:
...or run composer require gidix/pushnotifier-php
Usage
You only have to use one class: GIDIX\PushNotifier\SDK\PushNotifier
. Everything is derived from there.
Creating your Application
Before you can actually do anything, you have to create your application. It consists of an API Token and a package name. Both can be configured at pushnotifier.de/account/api.
Then you can create your instance:
Login
When authenticating as a user you have to log them in, then use their AppToken for all further communication:
You can store $appToken
anywhere you like by converting it to a string before storing (see examples/storing-app-token.php
).
Afterwards you can use the AppToken to authenticate:
Retrieving Devices
will retrieve an array of GIDIX\PushNotifier\SDK\Device
objects, containing an ID, a title, a model and a link to an image of the device. Device IDs do not change over time and serve as a unique identifier.
Sending Texts
$devices
has to be an array of either Device
objecs or device ID strings, i.e. ['abc', 'xyz']
.
Sending URLs
$devices
has to be an array of either Device
objecs or device ID strings, i.e. ['abc', 'xyz']
.
Sending Notifications
Exceptions
- DeviceNotFoundException: When a device couldn't be found
- InvalidAPITokenException: When the api_token or package couldn't be verified
- InvalidAppTokenException: When the AppToken couldn't be verified or has expired
- InvalidCredentialsException: When login credentials were incorrect
- InvalidRequestException: When some request data was malformatted, i.e. malformatted URL for notifications
- PushNotifierException: Base Exception for all these, only thrown in case of an unknown error (500)
$devices
has to be an array of either Device
objecs or device ID strings, i.e. ['abc', 'xyz']
.
Examples
Examples can be found in examples/
of this repository.