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-10-15 01:41:36 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 does
-
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.
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.
Testing
composer test
Licence
MIT.