PHP code example of pfrug / clear-logs

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

    

pfrug / clear-logs example snippets


'providers' => [
    ...
    Pfrug\ClearLogs\ClearLogsServiceProvider::class,
];

/*
 * Number of days to preserve logs
 * @var int
 */
'days' => 7,

/**
 * Indicates the criteria to evaluate the date of the log file to be deleted.
 * it can be by date of modification or by name of the file ej:"laravel-2022-05-22.log"
 * @var String mit|name
 */
'evalDateByNameOrMTime' => 'name',
 sh
php artisan vendor:publish --provider="Pfrug\ClearLogs\ClearLogsServiceProvider"
 php
protected function schedule(Schedule $schedule)
{
    $schedule->command('log:clear')->daily();
}
sh
php artisan vendor:publish --tag="clear-logs-config"