PHP code example of fei / audit-package

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




use ObjectivePHP\Application\AbstractApplication;
use Fei\Service\Audit\Package\AuditPackage;

class Application extends AbstractApplication
{
    public function init()
    {
        // Define some application steps
        $this->addSteps('init', 'bootstrap', 'auth', 'route', 'rendering');
        
        // Initializations...

        // Plugging the Audit Package in the bootstrap step
        $this->getStep('bootstrap')
        ->plug(AuditPackage::class);

        // Other initializations...
    }
}


class AnyMiddleware {

    public function __invoke(ApplicationInterface $app) {
        // please note that it's a better practice to inject the audit client 
        // into the middleware rather than pulling it from the container
        $auditClient = $app->getServicesFactory()->get('audit.client');
    }

}



use Fei\Service\Audit\Client\Audit;
use Fei\Service\Audit\Package\Config\AuditParam;
return [
    new AuditParam([Audit::OPTION_BASEURL => 'http://audit.dev:8181']),
];