jeffersongoncalves / laravel-lgpd-incidents
LGPD security incident register for Laravel: track incidents, risk assessment and the 3-business-day ANPD and data subject notification deadline (Resolução CD/ANPD 15/2024).
Package info
github.com/jeffersongoncalves/laravel-lgpd-incidents
pkg:composer/jeffersongoncalves/laravel-lgpd-incidents
Requires
- php: ^8.2
- illuminate/console: ^12.0|^13.0
- illuminate/contracts: ^12.0|^13.0
- illuminate/database: ^12.0|^13.0
- illuminate/support: ^12.0|^13.0
- jeffersongoncalves/laravel-brazil-holidays: ^1.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- jeffersongoncalves/pest-plugin-database-migrations: ^1.0
- larastan/larastan: ^3.0
- laravel/pint: ^1.24
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^3.0|^4.0
- pestphp/pest-plugin-laravel: ^3.0|^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A register of security incidents involving personal data, following the Brazilian General Data Protection Law (LGPD, art. 48) and the ANPD's incident regulation (Resolução CD/ANPD 15/2024).
- Deadline in business days: you have 3 business days, counted from when you learned the incident affected personal data, to notify the ANPD and the data subjects (art. 6 and 9). Weekends and Brazilian holidays are skipped with laravel-brazil-holidays.
- Risk assessment: only incidents that may cause relevant risk or damage must be communicated. An incident assessed as low risk no longer counts down, and you keep the reasoning on record.
- Kept for 5 years: the register must be kept for at least 5 years (art. 10), so younger records can't be deleted.
This package gives you tooling. It does not make you compliant on its own. It does not send anything to the ANPD: the communication is made through the ANPD's own channel, and you record the protocol here.
Installation
composer require jeffersongoncalves/laravel-lgpd-incidents
php artisan vendor:publish --tag="lgpd-incidents-migrations"
php artisan migrate
Upgrading from 1.0
Version 1.1 adds two columns that track partial notices, and lgpd:incidents-overdue reads them. Publish the new migration and run it:
php artisan vendor:publish --tag="lgpd-incidents-migrations"
php artisan migrate
Small processing agents get double the time (Resolução CD/ANPD 2/2022, art. 14): publish the config and set deadline_business_days to 6. Add state or city holidays in laravel-brazil-holidays' extra config.
Usage
use JeffersonGoncalves\LgpdIncidents\Enums\Risk; use JeffersonGoncalves\LgpdIncidents\Facades\LgpdIncidents; $incident = LgpdIncidents::open('Database backup exposed', discoveredAt: now(), attributes: [ 'description' => 'A backup bucket was public for 2 hours.', 'data_categories' => ['personal', 'financial'], 'affected_subjects' => 1200, ]); $incident->due_at; // end of the 3rd business day after discovery LgpdIncidents::assess($incident, Risk::Relevant); LgpdIncidents::notifyAnpd($incident, protocol: 'ANPD-2026-0042'); LgpdIncidents::notifySubjects($incident); LgpdIncidents::close($incident, measures: 'Bucket made private, credentials rotated.');
$incident->isPending() is true while a communication is still owed. It stays false for incidents assessed as low risk or closed. isOverdue() is true when that communication is past the deadline. Both are also query scopes: Incident::query()->scopes('overdue').
Partial notice
When you don't have every detail within the deadline, you can notify the ANPD with what you know and send the rest within 20 business days of that notice (art. 6, §3):
LgpdIncidents::notifyAnpd($incident, protocol: 'ANPD-2026-0042', partial: true); $incident->complement_due_at; // end of the 20th business day after the notice $incident->owesComplement(); // true until you record it LgpdIncidents::complement($incident);
isComplementOverdue() and the complementOverdue scope flag the ones past that date.
Overdue alerts
// routes/console.php Schedule::command('lgpd:incidents-overdue')->hourly();
The command dispatches IncidentOverdue for each overdue incident, and IncidentComplementOverdue for each overdue complement to a partial notice. Listen to it to alert your data protection officer. IncidentOpened is dispatched when an incident is registered.
Testing
composer test
Changelog
See CHANGELOG.
License
The MIT License (MIT). See License File.
