PHP code example of linkorb / silex-provider-app-event

1. Go to this page and download the library: Download linkorb/silex-provider-app-event 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/ */

    

linkorb / silex-provider-app-event example snippets


// app/app.php or app/bootstrap.php

use LinkORB\AppEventLogger\Provider\AppEventLoggerProvider;
...

$app->register(
    new AppEventLoggerProvider,
    [
        'linkorb_app_event.path' => 'path/to/a/logfile.ndjson',
    ]
);

class LoginController
{
    public function indexAction(Application $app, Request $request)
    {
        ...

        $app['linkorb_app_event.logger']->info('login.success', ['username' => 'lara']);
    }
}

// app/app.php or app/bootstrap.php
$app->register(
    new AppEventLoggerProvider,
    [
        'linkorb_app_event.path' => 'path/to/a/logfile.ndjson',

        // the minimum log level can be changed from the default INFO
        'linkorb_app_event.level' => DEBUG,

        // the TagProcessor will add tags to log records
        'linkorb_app_event.tags' => ['mytag' => null, 'othertag' => 'a-value'],

        // the TokenProcessor, which adds info about the currently
        // authenticated user, can be disabled
        'linkorb_app_event.token_processor' => false,
    ]
);