2017 © Pedro Peláez
 

library cleaner

Garbage cleaner package for Laravel

image

misterpaladin/cleaner

Garbage cleaner package for Laravel

  • Tuesday, August 29, 2017
  • by MisterPaladin
  • Repository
  • 2 Watchers
  • 0 Stars
  • 1,593 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 1 % Grown

The README.md

Cleaner

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Garbage cleaner package for Laravel, (*2)

Usage

Install package:, (*3)

$ composer require misterpaladin/cleaner

Publish config file to your project:, (*4)

$ php artisan vendor:publish --tag=cleaner

Add MisterPaladin\Cleaner\CleanerServiceProvider to your config/app.php providers array, (*5)

Configuration

/config/cleaner.php file contents:, (*6)

return [

    // Delete file after 3 days and 12 hours
    [
        'path' => 'path/to/file.ext',
        'expires' => [
            'days' => 3,
            'hours' => 12,
        ],
    ],

    // Delete directory after 30 minutes
    [
        'path' => 'path/to/directory',
        'expires' => [
            'minutes' => 10,
        ],
    ],

    // Delete directory contents after 1 week
    [
        'path' => 'path/to/directory/*',
        'expires' => [
            'weeks' => 1,
        ],
    ]

    // Define a path array
    [
        'path' => [
            'path/to/file.ext',
            'path/to/directory',
            'path/to/directory/*',
        ],
        'expires' => [
            'weeks' => 1,
        ],
    ]

];

The expires option may accept: - seconds - minutes - hours - days - weeks - months - years, (*7)

Callbaks

[
    'path' => 'path/to/file.ext',
    'expires' => [
        'days' => 3,
        'hours' => 12,
    ],
    'before' => function ($path) {
        // Execute before deleting the file
    },
    'after' => function ($path) {
        // Execute after deleting the file
    },
],

Execution

Cleaner runs every minute (if you set it up: https://laravel.com/docs/5.4/scheduling#introduction), (*8)

Manual run: php artisan cleaner:run, (*9)

The Versions

29/08 2017

dev-master

9999999-dev

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

29/08 2017

1.0.9

1.0.9.0

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

20/02 2017

1.0.8

1.0.8.0

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

20/02 2017

1.0.7

1.0.7.0

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

13/02 2017

1.0.6

1.0.6.0

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

13/02 2017

1.0.5

1.0.5.0

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

05/06 2016

1.0.4

1.0.4.0

Garbage cleaner package for Laravel

  Sources   Download

MIT

by Eugene Min

04/06 2016

1.0.3

1.0.3.0

Garbage cleaner package for Laravel

  Sources   Download

ISC

by Eugene Min

28/05 2016

1.0.2

1.0.2.0

Garbage cleaner package for Laravel

  Sources   Download

ISC

by Eugene Min

08/05 2016

1.0.1

1.0.1.0

Garbage cleaner package for Laravel

  Sources   Download

ISC

by Eugene Min

08/05 2016

1.0

1.0.0.0

Garbage cleaner package for Laravel

  Sources   Download

ISC

by Eugene Min