PHP code example of mapalagama / uaship

1. Go to this page and download the library: Download mapalagama/uaship 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/ */

    

mapalagama / uaship example snippets


use Mapalagama\UAShip\UAShip

$uaShip = new UAShip("**app_key_here**", "**app_master_secret**");

$uaShip->addAlert("This is alert");

$uaShip->addChannel(UAShip::IOS, "**Channel_id_here**");
$uaShip->addChannel(UAShip::ANDROID, "**Channel_id_here**");

$extra = new stdClass();
$extra->question = "what is your name ?";

$uaShip->addExtra($e);

$result = $uaShip->send();

   //initialization
    $uaShip = new UAShip("**APP_KEY**", "**APP_MASTER_SECRET**");
    
    //add alert message
    $uaShip->addAlert("This is alert");

    //add channels
    $uaShip->addChannel(UAShip::IOS, "**CHANNEL_ID**");
    $uaShip->addChannel(UAShip::ANDROID, "**CHANNEL_ID**");

    //add extra
    $extra = new stdClass();
    $extra->question = "what is your name ?";
    $uaShip->addExtra($extra);

    //send
    echo $uaShip->send();