eftalyurtseven / ionicPushClass

Ionic push with PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Ionic Push Class

It allows you to send notifications you created via Apps.ionic.io with PHP.

Usage

Ionic Profile Name and Auth Key required for construction function.

$setArray =  [
'profileName' => 'your-profile-name',
'AuthKey' => 'your-auth-key'
];

Set your devices

$devices = ['your-device-tokens'];
$notifyConfig = [
    'title' => "Your push title",
    "message" => "your push message!",
    "android" => [
        'title' => "Your push title",
        "message" => "your push message!",
        "sound" => "your-sound-src" // default
    ],
    "ios" => [
        'title' => "Your push title",
        "message" => "Your push title",
        "sound" => "your-sound-src" // default
    ]
];

Everything's ready, let's call the class now

$IonicPush = new IonicPush($setArray);
$IonicPush -> getDevices($devices);
$IonicPush -> setNotificationArray($notifyConfig);
if ($IonicPush -> send()){
    echo 'Push sent!';
}else {
    print_r (  $IonicPush -> err );
}

About

Ionic push with PHP

License:MIT License


Languages

Language:PHP 100.0%