PHP code example of alexjose / audit-log

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

    

alexjose / audit-log example snippets


$auditLog = new AuditLog();
$auditLog->log([
    'New User Registerd',
    'User',
    'creation',
    1,
    'user',
    '[email protected]',
    [
        'username' => 'john',
        'email' => '[email protected]'
    ],
    null,
    1,
    'user',
    '[email protected]',
]);

    /**
     * @param Event|array $event
     */
    public function log($event): void

    /**
     * @param string $message The title of the log
     * @param string $event The unique name of event
     * @param string $entityId The id of the entity which got modified
     * @param string $entityType The type to entity which got modified
     * @param string $entityTitle The title of the entity which got modified
     * @param array $newValues The new values of the entity
     * @param array|null $oldValues The old values of the entity
     * @param string $userId The id of the user who made the change
     * @param string $userType The type of the user who made the change
     * @param string $username The username of the user who made the change
     */
    public function __construct(
        $message,
        $module,
        $event,
        $entityId,
        $entityType,
        $entityTitle,
        $newValues,
        $oldValues,
        $userId,
        $userType,
        $username
    ):void