1. Go to this page and download the library: Download vocweb/laravel-log-compress 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/ */
vocweb / laravel-log-compress example snippets
return [
// Encryption password (overrides env if set)
'password' => env('LOG_COMPRESS_PASSWORD', null),
// Delete original log files after successful compression
'delete_after_compress' => true,
// Only compress logs older than N days (prevents active log compression)
'older_than_days' => 1,
// Automatically schedule daily compression (default: true)
'auto_schedule' => env('LOG_COMPRESS_AUTO_SCHEDULE', true),
// Time of day for auto-scheduled compression (24h format)
'schedule_time' => env('LOG_COMPRESS_SCHEDULE_TIME', '00:00'),
];
protected function schedule(Schedule $schedule)
{
$schedule->command('log:compress')->dailyAt('02:00');
}
use Illuminate\Support\Facades\Schedule;
Schedule::command('log:compress')->dailyAt('02:00');
use Illuminate\Console\Scheduling\Schedule;
->withSchedule(function (Schedule $schedule) {
$schedule->command('log:compress')->dailyAt('02:00');
})