What Is Clonio CLI?
Clonio CLI is a tool that copies a production database into development, CI, and test environments while rewriting sensitive columns in transit. It fakes names and emails, masks tokens, and remaps primary keys so the resulting dataset is fully usable but no longer identifies real people.
It ships as a standalone binary, a PHAR archive, a Docker image, or a Composer dev dependency:
composer require --dev clonio-dev/clonio-cli
Configuration lives in a version-controlled .cloning.yaml file that references connection names rather than raw credentials, making it safe to commit alongside your application code.
Column Transformation Strategies
Every column you want to transform gets an explicit strategy in the YAML config. Columns you don't list are copied as-is, so you only describe the data that actually needs to change.
| Strategy | What it does |
|---|---|
| fake | Generate synthetic values via FakerPHP |
| mask | Keep leading characters, mask the rest |
| hash | One-way hash (pseudonymization, not full anonymization) |
| static | Replace with a fixed string |
| null | Set the column to NULL |
| template | Mix literal text with Faker placeholders |
| remapping | Reassign primary keys and update dependent foreign keys |
A trimmed users table configuration looks like this:
version: "1"
connection: production
options:
faker_locale: de_DE
tables:
users:
rows:
strategy: last
limit: 5000
sort_by: created_at
columns:
email:
strategy: fake
faker_method: safeEmail
first_name:
strategy: fake
faker_method: firstName
phone:
strategy: mask
internal_notes:
strategy: "null"
Importantly, Clonio explicitly notes that hash output still counts as personal data under GDPR. When re-identification must be impossible, use fake or null instead.
Key Remapping Across Related Tables
Importing rows into a target database can collide with existing primary keys. The remapping strategy replaces a table's primary keys with new values and consistently updates all foreign keys in dependent tables, preserving referential integrity across the transfer.
PII Detection
Rather than relying on developers to manually audit every column, Clonio ships built-in matchers that flag columns likely to hold PII. Three commands support this workflow:
matchers:init— sets up baseline detection patternsmatchers:list— shows the currently active rulesmatchers:check— validates your tables against those rules
This catches newly added columns — like an email or tax_id field someone added without a corresponding transformation strategy — before they reach a less-trusted environment.
Audit Trail
Every cloning run can emit a signed audit artifact plus structured logs. Delivery targets include local storage, S3-compatible storage, Slack, Microsoft Teams, or email. The cloning:verify-audit command checks log integrity after the fact, which is useful when you need to demonstrate that production data was anonymized before it left the production environment.
Basic Workflow
clonio init
clonio connection:add production --production
clonio cloning:dump --connection production
clonio cloning:run production.cloning.yaml --target ci
Clonio runs on Linux x86_64/aarch64 and macOS Apple Silicon as a standalone binary (no PHP required), or via PHAR on PHP 8.5+, or as a Docker image at ghcr.io/clonio-dev/clonio:latest.
Key Takeaways
- Per-column anonymization strategies give you fine-grained control over exactly what gets transformed.
hashis pseudonymization, not anonymization — usefakeornullfor true GDPR compliance.- Key remapping maintains referential integrity when importing into an existing target database.
- Built-in PII detection catches sensitive columns that lack a transformation strategy.
- Signed audit artifacts provide a verifiable record that anonymization occurred.
- The
.cloning.yamlconfig is credential-free and safe to commit to version control.
Source: Clonio CLI: Clone Production Databases With Anonymized Data — Laravel News