PHP code example of justpush / justpush-php-sdk

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

    

justpush / justpush-php-sdk example snippets


$response = JustPushMessage::token('REPLACE_WITH_USER_TOKEN')
    ->message('Here is a sample Message')
    ->title('Test Title')
    ->create();

echo json_encode($response->result(), JSON_PRETTY_PRINT); //Result
echo json_encode($response->responseHeaders(), JSON_PRETTY_PRINT); //Response Headers

$response = JustPushTopic::token('REPLACE_WITH_USER_TOKEN')
    ->title('New Topic')
    ->create();
    
echo json_encode($response->result(), JSON_PRETTY_PRINT); //Result
echo json_encode($response->responseHeaders(), JSON_PRETTY_PRINT); //Response Headers


$response = JustPushTopic::token('REPLACE_WITH_USER_TOKEN')
    ->topic('REPLACE_WITH_TOPIC_UUID')
    ->title('New Topic Title')
    ->update();
    
echo json_encode($response->result(), JSON_PRETTY_PRINT); //Result
echo json_encode($response->responseHeaders(), JSON_PRETTY_PRINT); //Response Headers


$response = JustPushTopic::token('REPLACE_WITH_USER_TOKEN')
    ->topic('REPLACE_WITH_TOPIC_UUID')
    ->get();

echo json_encode($response->result(), JSON_PRETTY_PRINT); //Result
echo json_encode($response->responseHeaders(), JSON_PRETTY_PRINT); //Response Headers
bash
composer