PHP code example of bcrowe / growl

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

    

bcrowe / growl example snippets



use BryanCrowe\Growl\Growl;

$Growl = new Growl;

// Or...

use BryanCrowe\Growl\Growl;
use BryanCrowe\Growl\Builder\GrowlNotifyBuilder;

$Growl = new Growl(new GrowlNotifyBuilder('/usr/local/bin/growlnotify'));


(new Growl)
    ->setOption('title', 'Hello World')
    ->setOption('message', 'How are you doing?')
    ->setOption('sticky', true)
    ->execute();

// Or...

$Growl = new Growl;
$Growl->setOptions([
        'title' => 'Hello World',
        'message' => 'How are you doing?',
        'sticky' => true
    ])
    ->buildCommand();

exec($Growl);


// Completely disable escaping...
(new Growl)
    ->setOptions([
        'title' => 'Hello World',
        'message' => 'How are you doing?',
        'url' => 'http://www.google.com'
    ])
    ->setEscape(false)
    ->execute();

// Set a safe-list of option keys. Can be an array of option keys, or a string.
(new Growl)
    ->setOptions([
        'title' => 'Hello World',
        'message' => $mySafeMessage,
        'url' => $mySafeURL
    ])
    ->setSafe(['message', 'url'])
    ->execute();