Laravel Personal Data Export is a package that makes it easy to let a user download an export containing all personal data. Such an export consists of a zip file containing all user properties and related info.

This package also offers an artisan command to remove old zip files.

laravel package


You can install the package via composer:

composer require spatie/laravel-personal-data-export

You need to use this macro in your routes file. It 'll register a route where users can download their personal data exports.

// in your routes file


You must add a disk named personal-data-exports to config/filesystems (the name of the disk can be configured in config/personal-data-export). You can use any driver that you want. We recommend that your disk is not publicly accessible. If you're using the local driver, make sure you use a path that is not inside the public path of your app.

// in config/filesystems.php

// ...

'disks' => [

    'personal-data-exports' => [
        'driver' => 'local',
        'root' => storage_path('app/personal-data-exports'),

// ...

To automatically clean up older personal data exports, you can schedule this command in your console kernel:

// app/Console/Kernel.php

protected function schedule(Schedule $schedule)

Optionally you can publish the config file with:

php artisan vendor:publish --provider="Spatie\PersonalDataExport\PersonalDataExportServiceProvider" --tag="config"

Source Code