PHPackages                             milenmk/laravel-gdpr-exporter - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. milenmk/laravel-gdpr-exporter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

milenmk/laravel-gdpr-exporter
=============================

A GDPR-compliant user data exporter with Livewire support.

1.3.2(8mo ago)2999—0%MITPHPPHP ^8.2|^8.3|^8.4

Since Jul 31Pushed 8mo agoCompare

[ Source](https://github.com/milenmk/laravel-gdpr-exporter)[ Packagist](https://packagist.org/packages/milenmk/laravel-gdpr-exporter)[ RSS](/packages/milenmk-laravel-gdpr-exporter/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (7)Used By (0)

Laravel GDPR Exporter
=====================

[](#laravel-gdpr-exporter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ee423c106670bc99821641cf2cce4a73a921b4d2e8349f8e86d721bdefc864ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d696c656e6d6b2f6c61726176656c2d676470722d6578706f727465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/milenmk/laravel-gdpr-exporter)[![Total Downloads](https://camo.githubusercontent.com/f709f40048fe54c9d0f56b0215c6843b9b11d21005a6a82b33194449e1029ac2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d696c656e6d6b2f6c61726176656c2d676470722d6578706f727465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/milenmk/laravel-gdpr-exporter)[![GitHub User's stars](https://camo.githubusercontent.com/0112fb9b05079e0522d0de3766123ba9bf570329a1ff3c32eb7757fdbbdf0d3f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d696c656e6d6b2f6c61726176656c2d676470722d6578706f72746572)](https://github.com/milenmk/laravel-gdpr-exporter)[![Laravel 10 Support](https://camo.githubusercontent.com/0b7f902482de7d3663b7aa6b87b7caca6e7b3fed489112e6f65f79f4514e60de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e7825374331312e7825374331322e782d6f72616e67653f7374796c653d666c6174266c6f676f3d6c61726176656c)](https://laravel.com/docs)[![PHP Version Support](https://camo.githubusercontent.com/3397aedcf99a6767ca4e2438536e6548b5f650ae8d7fcdd326ce414375648b6f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d696c656e6d6b2f6c61726176656c2d676470722d6578706f727465723f7374796c653d666c6174)](https://www.php.net)[![License](https://camo.githubusercontent.com/ec4b815b0e9c71c5ccfe2b7de75c80ad90a75ed1f617236cff82873d49cf1a0c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d696c656e6d6b2f6c61726176656c2d676470722d6578706f727465722e7376673f7374796c653d666c6174)](https://github.com/milenmk/laravel-gdpr-exporter/blob/develop/LICENSE.md)[![Contributions Welcome](https://camo.githubusercontent.com/9e93e892d0685e1bf7a1d0bd7c8410d6ecf2086a0a7b48dd58a6b96fa556ea2a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6e747269627574696f6e732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/milenmk/laravel-gdpr-exporter/issues)[![Sponsor me](https://camo.githubusercontent.com/2aff1b5ae52a46452f3284b52645e299f456561d4dfd9b4d20d0a00a8351a123/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d2545322539442541342d6666363962343f7374796c653d666c6174)](https://www.patreon.com/c/LaravelAddonsbyMilen)

A lightweight Livewire component for exporting user data in multiple GDPR-compliant formats: JSON, CSV, XML, and HTML.

---

✨ Features
----------

[](#-features)

- Export authenticated user data in:
    - ✅ JSON
    - ✅ CSV
    - ✅ XML
    - ✅ HTML
- Automatically loads all Eloquent relations
- Filter out ID columns and other columns ending in `_id` or `_by`
- Streamed downloads
- Beautifully formatted output
- Built with Livewire 3
- Configurable relation detection (reflection or whitelist)
- Customizable export settings

---

🧰 Requirements
--------------

[](#-requirements)

- PHP 8.2+
- Laravel 10+
- Livewire 3+

---

📦 Installation
--------------

[](#-installation)

```
composer require milenmk/laravel-gdpr-exporter

```

🚀 Usage
-------

[](#-usage)

1. Add the Livewire component in your Blade view:

    ```

    ```
2. Optional: Publish the configuration file:

    ```
    php artisan vendor:publish --tag=laravel-gdpr-exporter-config

    ```
3. Optional: Publish the Blade view if you want to customize the UI:

    ```
    php artisan vendor:publish --tag=laravel-gdpr-exporter-views

    ```

    This will publish the file in `resources/views/vendor/laravel-gdpr-exporter/livewire/gdpr.blade.php`

📁 Export Formats
----------------

[](#-export-formats)

FormatOutputContent-TypeJSONPretty-printed user dataapplication/jsonCSVKey-value flat listtext/csvXMLNested XML documentapplication/xmlHTMLStyled HTML tabletext/html⚙️ Configuration
----------------

[](#️-configuration)

The package provides several configuration options in config/gdpr-exporter.php:

### User Model

[](#user-model)

Specify the user model class to use for GDPR exports:

```
'user_model' => env('GDPR_USER_MODEL', 'App\Models\User'),

```

### Relations Detection

[](#relations-detection)

Choose between automatic reflection-based detection or explicit whitelist:

```
'relations_detection' => [
    'method' => env('GDPR_RELATIONS_METHOD', 'whitelist'), // 'reflection' or 'whitelist'

    // When using 'whitelist' method, only these relations will be loaded
    'whitelist' => [
        // Example: 'posts', 'profile', 'roles', 'permissions'
    ],

    // When using 'reflection' method, these methods will be excluded
    'excluded_methods' => [
        'delete', 'destroy', 'forceDelete', 'restore', 'save',
        // ... more methods listed in the config file
    ],
],

```

### Export Settings

[](#export-settings)

Configure how data is processed during export:

```
'export' => [
    // Whether to remove ID fields from the exported data
    'remove_ids' => env('GDPR_REMOVE_IDS', true),

    // Whether to flatten pivot table data in the export
    'flatten_pivot' => env('GDPR_FLATTEN_PIVOT', true),
],

```

🧠 How It Works
--------------

[](#-how-it-works)

- Uses reflection to detect all Eloquent relationships on the User model.
- Loads relations and transforms the entire user structure to an array.
- Removes internal ID fields and flattens pivot data.
- Outputs the cleaned data in the selected format.

🔧 Troubleshooting
-----------------

[](#-troubleshooting)

### "Table 'notifications' doesn't exist" Error

[](#table-notifications-doesnt-exist-error)

If you encounter an error like `SQLSTATE[42S02]: Base table or view not found: 1146 Table 'notifications' doesn't exist`, this happens when your User model uses the `Notifiable` trait but you don't have the notifications database table (common when using only email notifications).

**Solutions:**

1. **Use Whitelist Method (Recommended)**: Configure the package to use the whitelist method and only include the relations you want to export:

    ```
    // config/gdpr-exporter.php
    'relations_detection' => [
        'method' => 'whitelist',
        'whitelist' => [
            'posts', 'profile', 'roles', // Add your actual relations here
            // Don't include 'notifications' if you don't have the table
        ],
    ],
    ```
2. **Exclude Notifications from Reflection**: If you prefer using reflection, add 'notifications' to the excluded methods:

    ```
    // config/gdpr-exporter.php
    'relations_detection' => [
        'method' => 'reflection',
        'excluded_methods' => [
            // ... other excluded methods
            'notifications', // Add this line
        ],
    ],
    ```
3. **Create the Notifications Table**: If you want to support database notifications in the future:

    ```
    php artisan notifications:table
    php artisan migrate
    ```

The package now includes built-in error handling that will gracefully skip relations that cause database errors, but using the whitelist method is still the safest approach.

Contributing
------------

[](#contributing)

You can review the source code, report bugs, or contribute to the project by visiting the GitHub repository:

[GitHub Repository](https://github.com/milenmk/laravel-gdpr-exporter)

Feel free to open issues or submit pull requests. Contributions are welcome!

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](CHANGELOG.md) for more information on what has changed recently.

Support My Work
---------------

[](#support-my-work)

If this package saves you time, you can support ongoing development:
👉 [Become a Patron](https://www.patreon.com/c/LaravelAddonsbyMilen)

Other Packages
--------------

[](#other-packages)

Check out my other Laravel packages:

- **[Laravel GDPR Cookie Manager](https://packagist.org/packages/milenmk/laravel-gdpr-cookie-manager)** - GDPR-compliant cookie consent management with user preference tracking
- **[Laravel Blacklist](https://packagist.org/packages/milenmk/laravel-blacklist)** - A Laravel package for blacklist validation of user input
- **[Laravel Email Change Confirmation](https://packagist.org/packages/milenmk/laravel-email-change-confirmation)** - Secure email change confirmation system
- **[Laravel Locations](https://packagist.org/packages/milenmk/laravel-locations)** - Add Countries, Cities, Areas, Languages and Currencies models to your Laravel application
- **[Laravel Rate Limiting](https://packagist.org/packages/milenmk/laravel-rate-limiting)** - Advanced rate limiting capabilities with exponential backoff
- **[Laravel Datatables and Forms](https://packagist.org/packages/milenmk/laravel-simple-datatables-and-forms)** - Easy to use package to create datatables and forms for Livewire components

License
-------

[](#license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

Disclaimer
----------

[](#disclaimer)

This package is provided "as is", without warranty of any kind, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, or noninfringement.

The author(s) make no guarantees regarding the accuracy, reliability, or completeness of the code, and shall not be held liable for any damages or losses arising from its use.

Please ensure you thoroughly test this package in your environment before deploying it to production.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance60

Regular maintenance activity

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

6

Last Release

257d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8b620564b17fda00eccd47bc8b4e61256537052c1b0f1f131e4196446a50fd0?d=identicon)[milenmk](/maintainers/milenmk)

---

Top Contributors

[![milenmk](https://avatars.githubusercontent.com/u/4587305?v=4)](https://github.com/milenmk "milenmk (13 commits)")

---

Tags

exportergdprgdpr-exportlaravellaravel-packagelivewire

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/milenmk-laravel-gdpr-exporter/health.svg)

```
[![Health](https://phpackages.com/badges/milenmk-laravel-gdpr-exporter/health.svg)](https://phpackages.com/packages/milenmk-laravel-gdpr-exporter)
```

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

703141.0k7](/packages/tallstackui-tallstackui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
