1. Go to this page and download the library: Download mifesta/laravel-log-cleaner 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/ */
mifesta / laravel-log-cleaner example snippets
" // other laravel-log-cleaner": "1.*"
},
protected $commands = [
// other kernel commands
\Mifesta\LogCleaner\Command\LogClearCommand::class,
];
namespace YourNamespace;
// your code
use Mifesta\LogCleaner\Facades\Cleaner;
class YourClass
{
public function yourMethod()
{
Cleaner::doSomething();
}
}
$cleaner = Cleaner::rotate(14);
if ($cleaner->clear()) {
echo 'Log files older than 14 days in default folder were cleared successfully.';
} else {
echo 'Log files older than 14 days in default folder were cleared with errors.';
}
if ($cleaner->dir('path_to_logs')->clear()) {
echo 'Log files older than 14 days in `path_to_logs` folder were cleared successfully.';
} else {
echo 'Log files older than 14 days in `path_to_logs` folder were cleared with errors.';
}
if (Cleaner::dir('path_to_logs')->clear()) {
echo 'Log files in `path_to_logs` folder were cleared successfully.';
} else {
echo 'Log files in `path_to_logs` folder were cleared with errors.';
}
shell
$ php artisan log:clear --help
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.