PHP code example of cybercog / php-pushwoosh

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

    

cybercog / php-pushwoosh example snippets


// Create a Pushwoosh client
$pushwoosh = Pushwoosh::create()
    ->setApplication('XXXX-XXX')
    ->setAuth('xxxxxxxx');

// Create a request for the '/createMessage' Web Service
$request = CreateMessageRequest::create()
    ->addNotification(Notification::create()->setContent('Hello Jean !'));

// Call the REST Web Service
$response = $pushwoosh->createMessage($request);

// Check if it's ok
if ($response->isOk()) {
    print 'Great, my message has been sent !';
} else {
    print 'Oops, the sent failed :-('; 
    print 'Status code : ' . $response->getStatusCode();
    print 'Status message : ' . $response->getStatusMessage();
}
shell script
composer