filagora / filagora-compliance
Cookie consent, policy versions and privacy requests (export and erasure) for Filagora.
Requires
- php: ^8.4
- filagora/filagora-core: ^0.2.1
- filament/filament: ^5.0
Requires (Dev)
- filagora/filagora-cms: ^0.2.1
- filagora/filagora-entitlements: ^0.2.1
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
Suggests
- filagora/filagora-cms: Creates a new cookie policy version when the cookie policy page is published.
- filagora/filagora-entitlements: Answers the access checks from entitlement grants. Without it, bind Filagora\Core\Contracts\AccessChecker.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-15 12:52:26 UTC
README
Cookie consent, policy versions and privacy requests (export and erasure) for Filagora, as a
Laravel 13 / Filament 5 plugin. Requires
filagora/filagora-core. Who may use the screens is
answered by core's AccessChecker: install
filagora/filagora-entitlements and it is
answered from entitlement grants, or bind your own checker. With neither, the screens deny
everyone.
The package is at
0.1: the API may change between0.xminor versions. There is no frontend: it is models, services, events, commands and staff screens, and you build the public forms (cookie banner, privacy request form) over the services.
What it provides
Overview
Cookie consent, policy versions and privacy requests (export and erasure) for Filagora.
Tables
cookie_consent_groups, cookie_consent_cookies, cookie_policy_versions, user_cookie_consents, privacy_policy_versions, user_privacy_policy_acceptances, privacy_requests, privacy_operation_audits, prefixed filagora_ by default. A site that already has them can run php artisan filagora:adopt instead of migrating.
Commands
| Command | What it does |
|---|---|
filagora:compliance:prune {--dry-run} |
Delete records that are past their retention period, as every installed package defines it. |
Events
PrivacyReplySent: Staff replied to the person who made a request.PrivacyRequestStatusChanged: A request moved from one status to another.PrivacyRequestSubmitted: A person made a privacy request.
Access
| Ability | Entitlement key |
|---|---|
filagora.compliance.privacy_requests.view |
filagora.compliance.privacy_requests.view |
filagora.compliance.privacy_requests |
filagora.compliance.privacy_requests |
filagora.compliance.erase |
filagora.compliance.erase |
filagora.compliance.cookie_policies |
filagora.compliance.cookie_policies |
filagora.compliance.privacy_policies |
filagora.compliance.privacy_policies |
filagora.compliance.audit |
filagora.compliance.audit |
Using it
-
Tables and models for cookie consent (groups, cookies, policy versions, each user's choice), the privacy policy (versions, each user's acceptance) and privacy requests (with legal hold and an operation audit). They match the site this package was extracted from, so
php artisan filagora:adoptaccepts that site's existing tables. IP addresses and user agents are stored only as hashes. -
Abilities
filagora.compliance.privacy_requests,.policiesand.audit, mapped to entitlement keys infilagora-compliance.gates. -
Cookie consent (
CookieConsent): the enabled groups and cookies to show, the choice a signed-in user made (one row per user, replaced on each save, under the active policy version), andrequiresReconsent()when the policy changed since.normalize()merges what was submitted over what the site declares: a required group is always on, a cookie's own choice wins over its group's, a group is on when any of its cookies is. Off when the settingenable_cookie_consent_workflowis off. -
Privacy policy acceptance (
PolicyAcceptance):hasAcknowledgedActivePolicy($user)is cheap enough for a middleware (the active version is cached),accept($user, $ip, $userAgent)records the acceptance,stateFor($user)gives everything a profile page needs. Off when the settingenforce_gdpris off. -
Cookie policy versions (
CookiePolicyVersions) are numbered by day (2026.10.14.1). Withfilagora/filagora-cmsinstalled, publishing the page named by the settingcookie_policy_page(a route beginning with/, or a page slug) creates a new version, so users are asked again. -
The package has no routes, views or JavaScript. Your endpoints are a few lines over the services, for example:
Route::post('/profile/cookie-consent', fn (Request $r, CookieConsent $consent) => response()->json($consent->save($r->user(), $r->validate(['groups' => 'array', 'cookies' => 'array']), $r->ip(), $r->userAgent())->consent)) ->middleware('auth');
-
Privacy requests (
PrivacyRequests): a person submits an export or erasure request (or rectification, restriction, objection, which staff handle by hand); staff review, hold, reply, reject, or fulfil it.fulfilExport()writes one JSON file with a section for the user and one for everyPrivacyContributorany package or your application registered with core'sPrivacyContributorRegistry;fulfilErasure()has each contributor erase its data and then yourUserAnonymizerreplaces who the user is, all in one transaction. A request on legal hold cannot be fulfilled. Every staff action is written to the operation audit, and the requester (and the address in thedsar_request_emailsetting) are emailed by events you can replace: setmail.enabledto false and listen toPrivacyRequestSubmitted,PrivacyRequestStatusChangedandPrivacyReplySentyourself. The mail's links are named routes of yours underroutesin the config (a signed download route for exports, the page where a person sees their requests); any you leave empty is left out. -
What erasure covers is up to what registers. Register a contributor for your own tables (
app(PrivacyContributorRegistry::class)->register(...)) and bind your ownUserAnonymizerfor user columns the default does not know (it blanksnameandemail, empties the verification date and makes the password unusable). -
Retention:
php artisan filagora:compliance:prune(scheduled daily at 02:15;--dry-runreports without deleting) runs everyRetentionRuleregistered with core'sRetentionRuleRegistry, so each package says what it keeps and for how long. This package's rule deletes settled privacy requests after the windows inretention.privacy_requests(never one on legal hold) and removes export files 30 days after they were made. A rule that fails is reported, mailed todsar_request_email, and does not stop the others. -
Filament screens (add
FilagoraCompliancePlugin::make()to your panel), each behind its own ability, mapped to keys infilagora-compliance.gates(entitlement keys when entitlements is installed): privacy requests (.privacy_requests.viewto look,.privacy_requeststo act,.eraseto erase a person or delete a request), cookie groups and cookie policy versions (.cookie_policies), privacy policy versions (.privacy_policies) and the operation audit (.audit). A request's page offers every step of its handling; the privacy KPIs (kpisin the config) can sit on your dashboard throughPrivacyKpiOverview.
Requirements
PHP 8.4, Laravel 13 and Filament 5. Tested against MariaDB 11.4. Requires filagora/filagora-core.
Install
composer require filagora/filagora-compliance filagora/filagora-entitlements # entitlements is optional php artisan migrate php artisan filagora:entitlements:sync # with entitlements: creates the ability keys
->plugin(\Filagora\Compliance\FilagoraCompliancePlugin::make())
Then set the dsar_request_email setting (who is told about new requests), schedule your
application's schedule:run (the daily prune is registered by the package), and read
config/filagora-compliance.php for the links in the mail, where exports are written and the
retention windows. To start from a database that already holds these tables, run
php artisan filagora:adopt instead of migrate.
Configuration
config/filagora-compliance.php is merged with the host's copy, so list only what
differs. Publish it with php artisan vendor:publish --tag=filagora-compliance-config.
Extending
Extend through documented contracts, events and registries. Anything not documented
is @internal.
Testing
composer test
Tests run against a real MariaDB, never SQLite, so engine behaviour (FULLTEXT,
ONLY_FULL_GROUP_BY, collation) matches production. Host and credentials come from
your environment; the database is always named testing, never your development one.
Local development (DDEV)
.ddev/ is included. ddev start creates both db and testing (run ddev restart once
if testing is missing), then ddev exec vendor/bin/pest.
Licence
MIT. See LICENSE.