PHP code example of erdaldemirci / laravel-geoip-log-cleaner

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

    

erdaldemirci / laravel-geoip-log-cleaner example snippets


"    // other geoip-log-cleaner": "1.*"
},

protected $commands = [
    // other kernel commands
    \ErdalDemirci\GeoIPLogCleaner\Command\LogClearCommand::class,
];



namespace YourNamespace;

// your code

use ErdalDemirci\GeoIPLogCleaner\Facades\Cleaner;

class YourClass
{
    public function yourMethod()
    {
        Cleaner::doSomething();
    }
}

$cleaner = Cleaner::rotate(14);

if ($cleaner->clear()) {
    echo 'GeoIP Log files older than 14 days in default folder were cleared successfully.';
} else {
    echo 'GeoIP Log files older than 14 days in default folder were cleared with errors.';
}

if ($cleaner->dir('path_to_logs')->clear()) {
    echo 'GeoIP Log files older than 14 days in `path_to_logs` folder were cleared successfully.';
} else {
    echo 'GeoIP 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 geoiplog:clear --help