- How do I install and set up ashallendesign/redactable-models in a Laravel app?
- Install it with Composer using composer require ashallendesign/redactable-models, then add the package trait to the Eloquent model you want to protect. Declare which attributes are redactable on that model, configure any package defaults you need, and trigger redaction from your erasure or retention workflow. A pilot on a single low-risk model is the easiest way to confirm behavior before wider rollout.
- Which Laravel and PHP versions does redactable-models support?
- Check the require block in the package composer.json for the exact PHP and Laravel constraints, and confirm they match your application before installing. The package is designed as a trait-based fit for modern Laravel applications using Eloquent, but you should verify the specific release you plan to pin. Also test interaction with existing traits such as SoftDeletes, UUIDs, audit logging, and searchable behavior.
- How do I mark attributes as redactable on an Eloquent model?
- Add the package trait to the model and declare the attributes that contain sensitive data, such as emails, passwords, phone numbers, or addresses. Once marked, the package masks or hides those values when the model is serialized, logged, or returned from an API. Keep the attribute list narrow and reviewed, because an overly broad list increases the risk of irreversible data loss.
- Does redactable-models require database migrations or schema changes?
- The package works at the model layer through a trait, so the core redaction approach avoids schema churn for most applications. If the specific version tracks redaction state in the database, plan an additive migration and backfill instead of modifying existing columns. Test on staging first and confirm whether your installed version expects any published configuration or storage changes.
- What happens to redacted values when a model is serialized to JSON or written to logs?
- Redactable attributes are masked or hidden when the model is serialized, logged, or returned from an API response, which helps prevent accidental leaks of passwords, emails, and other private information. The original value is not meant to be exposed through normal serialization paths once redaction has been applied. You should still review custom accessors, API resources, and logging channels that might read raw attributes directly.
- Can I undo a redaction or recover the original value?
- Treat redaction as generally irreversible; the package is intended to remove or mask data, not to provide a reversible vault. Recovery usually depends on restoring from backups, which is a heavyweight and potentially incomplete operation, especially if backups have expired. Use a dry run where possible, verify results, and require approval before any production redaction.
- How should I handle unique columns, foreign keys, and relationships when redacting models?
- Redaction can collide with unique constraints if placeholder or masked values repeat across rows, so define permitted replacement values and test them against your indexes. Foreign keys, relationship semantics, and search indexes also need deliberate handling to avoid orphaning records or leaving stale PII in derived data. Write tests for normal redaction, unique constraints, relationships, and model events before expanding beyond a pilot model.
- Is redactable-models enough for GDPR or CCPA right-to-erasure compliance?
- No single package is a complete compliance control; redactable-models is a useful model-boundary building block for PII minimization and erasure workflows in Eloquent applications. It does not cover PII held in logs, backups, analytics, data warehouses, event-sourced stores, or third-party systems, so those need separate orchestration. Combine it with a documented data map, approval workflow, audit evidence, and retention policy.
- Can I run redaction from a queued job or an erasure workflow?
- Yes, you can invoke redaction from an application job, command, or erasure and retention workflow, but whether it runs synchronously or queued is an application design decision. Consider model event side effects, queue serialization, partial redaction on failure, and how you will verify completion. Add audit logging and an approval step so you can show who authorized the redaction and when it finished.
- Is ashallendesign/redactable-models actively maintained, and what are the alternatives?
- The package is MIT licensed with community support and no SLA, and its relatively small ecosystem footprint (around 115 stars and zero dependents at assessment time) means limited third-party validation. Pin the version, monitor releases and security advisories, and keep an internal fallback feasible, such as a custom trait with placeholder mapping and redaction tests. Evaluate it as one building block rather than a complete compliance or anonymization platform.