PHP code example of silverstripe / auditor

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

    

silverstripe / auditor example snippets


use SilverStripe\CMS\Controllers\ContentController;

class MyPageController extends ContentController
{
    private static $dependencies = [
        'auditLogger' => '%$AuditLogger'
    ];
}

public function dostuff()
{
    $this->auditLogger->info('stuff happened');
    // You can also pass an arbitrary context array which will be