PHP code example of fei / audit-client

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

    

fei / audit-client example snippets


// sample configuration for production environment
$audit = new Audit(array(
                            Audit::OPTION_BASEURL  => 'http://audit.flash-global.net',
                            Audit::OPTION_FILTER   => AuditEvent::LVL_DEBUG,
                          )
                    );
// inject transport classes
$audit->setTransport(new BasicTransport());

// optionnal asynchronous transport, that will be automatically used to push notifications
//
// NOTE this transport 


$audit = $container->get('audit.client');

$audit->notify('AuditEvent message'); // default level is AuditEvent::LVL_INFO
$audit->notify('Debug message', array('level' => AuditEvent::LVL_DEBUG));


$audit = $container->get('audit.client');

$auditEvent = new AuditEvent(array('message' => 'AuditEvent message'));
$auditEvent
        ->setLevel(AuditEvent::LVL_WARNING)
        ->setContext(array('key' => 'value')
        ;
        
$audit->notify($auditEvent);