PHP code example of marshmallow / laravel-folder-cleaner

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

    

marshmallow / laravel-folder-cleaner example snippets


return [

    /**
     * You can specify the folders that should be cleaned in
     * this config array. We will search for these folders
     * in the root directory of you project.
     */
    'folders' => [
        // '/storage/logs',
        // '/storage' => [
        //     'older_than' => '3 months',
        //     'except' => [
        //         'important.log',
        //     ],
        // ],
        // '/storage/app' => [
        //     'older_than' => '1 day',
        //     'match' => '/^export_\d+\.xlsx$/',
        // ],
    ],
];

return [
    'folders' => [
        // '/storage/logs',
    ]
];

return [
    'folders' => [
        '/storage' => [
            'older_than' => '3 months',
            'match' => '/^export_\d+\.xlsx$/',
            'except' => [
                'export_1.xlsx',
            ],
        ],
    ]
];

return [
    'folders' => [
         '/storage/app/public/download' => [
            'delete_folders' => true,
            'older_than' => '7 days',
        ],
    ]
];
bash
php artisan folder-cleaner:install
bash
php artisan folder-cleaner:clean {--dry-run} {--quiet}