2017 © Pedro PelĂĄez
 

library webhookhandler

A monolog-handler that POSTs to a webhook

image

org_heigl/webhookhandler

A monolog-handler that POSTs to a webhook

  • Thursday, March 2, 2017
  • by heiglandreas
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,291 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

WebHookHandler

Log-Hander that POSTs a log-request using HTTPlug, (*1)

Installation

composer require org_Heigl/webhookhandler

Usage

  1. Create the handler
    $uriFactory = \Http\Discovery\UriFactoryDiscovery::find();
    $uri = $uriFactory->createUri('http://example.com/');

    $handler = new WebHookHandler(
        $uri,
        Logger::DEBUG,
        \Http\Discovery\HttpAsyncClientDiscovery::find(),
        Http\Discovery\MessageFactoryDiscovery::find()
    );

    $handler->setFrom('WhateverYouWant');
  1. Add the handler to the logger as you would with any other handler:
    $logger = new Logger('example');
    $logger->pushHandler($handler);
  1. Log as you are used to:
    $logger->log('Whatever you want to say');

The log-message will be send via a HTTP-POST to the provided URI (in this example to ```http://example.com/``)., (*2)

The post-body will be the following json_encoded array:, (*3)

[
    [message] => The message of the log-entry
    [from] => 'WhateverYouWant'
    [context] => []
    [level] => the set log-level
    [level_name] => the name of the set log-level
    [channel] => Whatever you set as channel name for the logger
    [datetime] => DateTime-Object
    [extra] => []
    [formatted] => The formatted message
 ]

That mainly is the array that monolog passes to the handlers
, (*4)

The Versions

02/03 2017

dev-master

9999999-dev https://github.com/heiglandreas/WebHookHandler

A monolog-handler that POSTs to a webhook

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging monolog webhook

02/03 2017

1.1.1

1.1.1.0 https://github.com/heiglandreas/WebHookHandler

A monolog-handler that POSTs to a webhook

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging monolog webhook

01/03 2017

1.1.0

1.1.0.0 https://github.com/heiglandreas/WebHookHandler

A monolog-handler that POSTs to a webhook

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging monolog webhook

01/03 2017

1.0.0

1.0.0.0 https://github.com/heiglandreas/WebHookHandler

A monolog-handler that POSTs to a webhook

  Sources   Download

MIT

The Requires

 

The Development Requires

log logging monolog webhook