Download the PHP package pachristos/filament-export-cleanup without Composer

On this page you can find all versions of the php package pachristos/filament-export-cleanup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-export-cleanup

Filament Export Cleanup

Latest Version on Packagist GitHub Tests Action Status Total Downloads Plumb score

Automatically remove old Filament export files from disk and optionally delete their exports table rows.

Filament table exports store files on disk and keep metadata in the database. Over time these accumulate. This package finds completed exports older than a configurable retention period, deletes their file directories, and optionally removes the database records.

Requirements

Installation

Install the package via Composer:

Publish the configuration file:

Or use the install command, which publishes the config for you:

The package auto-registers its service provider. No further setup is required beyond configuration.

Configuration

Configuration lives in config/filament-export-cleanup.php. All options can be overridden with environment variables.

Option Env variable Default Description
enabled FILAMENT_EXPORT_CLEANUP_ENABLED true Master switch for cleanup
retention_hours FILAMENT_EXPORT_CLEANUP_RETENTION_HOURS 72 Delete exports completed more than this many hours ago
delete_database_records FILAMENT_EXPORT_CLEANUP_DELETE_DATABASE_RECORDS true Also delete rows from the exports table
file_disk FILAMENT_EXPORT_CLEANUP_FILE_DISK local Filesystem disk to clean (must match your Filament export disk)
schedule.enabled FILAMENT_EXPORT_CLEANUP_SCHEDULE_ENABLED true Register the cleanup command on the Laravel scheduler
schedule.frequency Weekdays at 02:00 When to run (see Scheduling)

Set file_disk to the same disk your Filament exports use (local or public). S3 and other remote disks are not supported yet.

Usage

Scheduled cleanup (recommended)

When schedule.enabled is true, the package registers cleanup:filament-export on Laravel's scheduler. Ensure your server runs the scheduler (for example via cron):

The default schedule runs on weekdays at 02:00.

Manual cleanup

Run the Artisan command at any time:

The command reports how many export file directories were removed, or that nothing needed deletion.

Programmatic cleanup

Resolve the service from the container:

Or use the facade:

run() returns an array of deleted export IDs. When enabled is false, it returns an empty array without doing any work.

Scheduling

The schedule.frequency config controls when the cleanup command is registered on Laravel's scheduler. You can configure it with any of Laravel's schedule frequency options by passing a Closure that receives the scheduled Event and chains any combination of frequency methods (dailyAt(), hourly(), weekdays(), cron(), timezone constraints, etc.). A raw cron expression string is also accepted.

The default runs the cleanup on weekdays at 02:00:

Use any frequency method (or combination) Laravel supports. A few examples:

Or supply a raw cron expression directly:

Disable automatic scheduling and run cleanup only manually or from your own scheduler:

See the Laravel schedule frequency options documentation for the full list of available methods.

How it works

  1. Query the Filament exports table for records where completed_at is older than retention_hours and file_disk matches your configured disk.
  2. Delete each export's file directory from disk via Filament's Export model.
  3. If delete_database_records is true, delete the matching rows from the exports table.

Exports still within the retention window are left untouched.

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Sponsoring

Development of this package is supported by Christos Papoulas.

License

The MIT License (MIT). Please see License File for more information.


All versions of filament-export-cleanup with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/actions Version ^4.0|^5.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pachristos/filament-export-cleanup contains the following files

Loading the files please wait ...