PHP code example of drewlabs / changelog

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

    

drewlabs / changelog example snippets




// ...
use Drewlabs\Changelog\Logger;
// ...
// At the root of your application or when your application bootstraps

Logger::getInstance()->registerDriver(new MyLogger);

// or using a factory function
Logger::getInstance()->registerDriver(function() {
    return MyLogger
}, 'myLog');


// In some part of the code where we need to log table column changes
Logger::getInstance()->logChange('table_name', 'model_key', 'property_name', 'old_value', 'current_value', 'logged_by');