PHP code example of midnite81 / prowl

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

    

midnite81 / prowl example snippets



use Midnite81\Prowl\Prowl;
will use Guzzle to process our HTTP requests, but you can use anything that
 * implements the PHP-HTTP standard
 */

$prowl = Prowl::create(['apiUrl' => 'https://api.prowlapp.com/publicapi']); 

 
 
 use Midnite81\Prowl\Services\Notification;
 $notification = new Notification(); 
 // or 
 $notification = $prowl->createNotification(); 
 
 // Using this method you can chain through to send the message directly.
 $prowl = new Prowl($config); 
 $prowl->createMessage()
     ->setApiKeys($apiKey)
     ->setDescription('This is the description')
     ->setEvent('This is the event')
     ->setPriority(\Midnite81\Prowl\Services\Priority::NORMAL)
     ->setMessage('This is the message')
     ->setApplication('Application')
     ->send();
 
 
$notification->setApiKeys($myKey)
             ->setPriority(0)
             ->setEvent('The Event')
             ->setDescription('The Description')
             ->setApplication('The Application')
             ->setMessage('The Message');
 
$pushNotification = $prowl->add($notification);