PHP code example of dstuecken / notify

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

    

dstuecken / notify example snippets



$notificationCenter = new NotificationCenter();
$notificationCenter->addHandler(
    new HeaderHandler('Notify', NotificationCenter::ERROR)
);

$notificationCenter->error('There was an error.');


$logger = new Logger('my-logger');

$notificationCenter = new NotificationCenter();
$notificationCenter->addHandler(
    new LoggerHandler($logger, NotificationCenter::ERROR)
);

$notificationCenter->error('There was an error.');


$hipchat = new HipChat\HipChat('apiKey123', );

$notificationCenter = new NotificationCenter();
$notificationCenter->addHandler(
    new HipChatHandler($hipchat, 'hipchat-room-id', NotificationCenter::CRITICAL, 'hipChatBotName')
);

$notificationCenter->error('There was an error.');


$logger = new Logger('my-logger');

$notificationCenter = new NotificationCenter();
$notificationCenter
	->addHandler(
	    new HeaderHandler(
	        'Notify',
	        NotificationCenter::INFO
	    )
	)
	->addHandler(
	    new LoggerHandler(new Logger(), NotificationCenter::ERROR)
	);

$notificationCenter->error('There was an error.', HeaderHandler::formatAttributes(null, null, true));
shell
phpunit --bootstrap tests/bootstrap.php tests