Download the PHP package antlerslabs/ziggy-db without Composer
On this page you can find all versions of the php package antlerslabs/ziggy-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download antlerslabs/ziggy-db
More information about antlerslabs/ziggy-db
Files in antlerslabs/ziggy-db
Package ziggy-db
Short Description Secure, read-only production database pulls for local development with industry-standard guardrails.
License MIT
Homepage https://github.com/antlerslabs/ziggy-db
Informations about the package ziggy-db
Ziggy DB
Ziggy DB pulls production databases to local development databases through explicit, auditable, read-only guardrails.
The design goal is simple: a production pull should be boring and safe. It should fail loudly instead of doing something questionable.
Status
Implemented:
config/ziggy-db.phpziggy-db:verifyziggy-db:doctor
Planned next:
ziggy-db:pull- CLI dump and import drivers
- Table
only/skipenforcement during transfer - Staging, anonymization, and promotion
- Pull audit logging
Requirements
- PHP
^8.3 - Laravel
^12.0 || ^13.0 - A dedicated read-only production database user
- For the eventual transfer layer:
- MySQL/MariaDB:
mysqldumpandmysql - PostgreSQL:
pg_dumpandpsql - SQLite:
sqlite3 - Remote hosts:
ssh
- MySQL/MariaDB:
Run ziggy-db:doctor to check the binaries available on the current machine.
Installation
Install the package through Composer:
Publish the configuration:
Testing against a local copy
Ziggy DB is not published yet. Point a real application at this repository with a Composer path repository:
On Windows, enable Developer Mode so Composer can create the symlink. Otherwise Composer copies the package and the application will not see package edits until composer update antlerslabs/ziggy-db runs again.
Then require the development version:
Configuration
Set the source connection name in the package config or environment:
Define mysql_readonly as an ordinary connection in the application's config/database.php. Ziggy DB does not invent a separate credential format; it reuses Laravel database connections.
The published config controls:
| Key | Purpose |
|---|---|
source |
Source connection name. |
target |
Target connection name. null means the default connection. |
tables.only |
When non-empty, import data only for these tables. |
tables.skip |
Table data that is never imported. skip wins over only. |
guardrails.allowed_environments |
Application environments where pulls may run. |
guardrails.require_read_only |
Abort when source credentials look writable. |
guardrails.require_secure_transport |
Refuse unencrypted remote connections. |
guardrails.allowed_hosts |
Optional source host allowlist. |
guardrails.allowed_drivers |
Drivers Ziggy DB may pull from. |
guardrails.require_confirmation |
Require typing the target database name before import. Reserved for the pull command. |
anonymize.enabled |
Scrub configured columns before promotion. |
anonymize.columns |
table.column map, with * allowed as the table. |
audit.enabled |
Record pulls with source, duration, and outcome. |
audit.channel |
Log channel, or null for the default channel. |
Schema is always intended to remain complete. only and skip filter table data, not table structure. A skipped table should still exist locally, but stay empty, so the application boots normally.
Default skipped data includes operational tables:
Guardrails
Every pull starts from a configured Laravel connection. Verification inspects, in this order:
environmentdriverhost-allowlistsecure-transportread-only
MySQL and MariaDB
The read-only guardrail:
- Enables
SET SESSION TRANSACTION READ ONLY - Verifies the session setting took effect
- Reads
SHOW GRANTS FOR CURRENT_USER() - Fails when the user holds anything beyond:
SELECTUSAGESHOW VIEWLOCK TABLES
Unrecognized grants also fail. A reporting or backup role should not have an opaque privilege path to writes.
Remote MySQL connections must configure PDO SSL attributes. Local connections are exempt.
PostgreSQL
The read-only guardrail:
- Enables
SET default_transaction_read_only = on - Attempts to create a randomly named probe table in a transaction
- Rolls the transaction back
- Passes when PostgreSQL rejects the write
- Fails when the credentials accept the write
Remote PostgreSQL connections must use an sslmode of require, verify-ca, or verify-full. Local connections are exempt.
SQLite
SQLite has no database users. The guardrail locks the opened connection with PRAGMA query_only = ON. SQLite is useful for package development and tests, but it is not a production access-control boundary.
Commands
Verify a source
Exit code is zero only when every guardrail passes. The command prints a table naming each guardrail, its result, and explanatory detail.
Check local tooling
This reports whether mysqldump, mysql, pg_dump, psql, sqlite3, and ssh are available.
Planned pull behavior
The future ziggy-db:pull command will support:
Planned behavior:
- Run every source guardrail.
- Refuse application environments outside the allowlist.
- Require explicit confirmation unless
--forceis used in an allowed non-production context. - Dump with the matching CLI tool:
- MySQL/MariaDB:
mysqldump - PostgreSQL:
pg_dump - SQLite:
sqlite3
- MySQL/MariaDB:
- Import into an isolated staging target.
- Apply configured anonymization before promotion.
- Promote staging data to the requested target.
- Remove staging artifacts.
- Write one audit record for the pull.
Initial transfers are intentionally same-engine. CLI dumps cannot reliably move PostgreSQL SQL into MySQL without a row-level pipeline, which is a separate future feature.
Example workflow
- Create a read-only production MySQL user.
- Grant it only
SELECT, plusSHOW VIEWif views are needed. - Add that connection to the application as
mysql_readonly. - Require TLS or an SSH path to the server.
- Set
ZIGGY_DB_SOURCE=mysql_readonly. - Publish and review
config/ziggy-db.php. - Run
ziggy-db:doctor. - Run
ziggy-db:verify. - Fix every failing guardrail before attempting a pull.
- Run
ziggy-db:pullonly in a local environment.
Development
Full validation:
Focused checks:
Manipulate the Testbench workbench application:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Thank you for considering contributing to Ziggy DB! Please review our contributing guide to get started.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- eXeis-ixt
- All Contributors
License
Ziggy DB is open-sourced software licensed under the MIT license.
All versions of ziggy-db with dependencies
illuminate/database Version ^12.0||^13.0
illuminate/process Version ^12.0||^13.0
illuminate/support Version ^12.0||^13.0