{"id":16329518,"url":"https://github.com/elliotjreed/database-anonymiser","last_synced_at":"2026-02-07T05:02:23.008Z","repository":{"id":37550045,"uuid":"100979924","full_name":"elliotjreed/database-anonymiser","owner":"elliotjreed","description":"Database anonymisation package written in PHP using PDO (supports MySQL, SQLite, Postgres, et al).","archived":false,"fork":false,"pushed_at":"2024-12-15T12:16:44.000Z","size":487,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-26T06:41:56.538Z","etag":null,"topics":["anonymization","database","hacktoberfest","mysql","pdo","php","postgres","sqlite"],"latest_commit_sha":null,"homepage":"https://www.elliotjreed.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elliotjreed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-21T18:15:24.000Z","updated_at":"2024-02-23T21:08:31.000Z","dependencies_parsed_at":"2024-11-06T20:41:48.663Z","dependency_job_id":"f08f05dd-6eb0-413a-b150-9573b44d9f10","html_url":"https://github.com/elliotjreed/database-anonymiser","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elliotjreed/database-anonymiser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotjreed%2Fdatabase-anonymiser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotjreed%2Fdatabase-anonymiser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotjreed%2Fdatabase-anonymiser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotjreed%2Fdatabase-anonymiser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elliotjreed","download_url":"https://codeload.github.com/elliotjreed/database-anonymiser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elliotjreed%2Fdatabase-anonymiser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29186742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T03:35:06.566Z","status":"ssl_error","status_checked_at":"2026-02-07T03:34:57.604Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anonymization","database","hacktoberfest","mysql","pdo","php","postgres","sqlite"],"created_at":"2024-10-10T23:15:55.949Z","updated_at":"2026-02-07T05:02:22.995Z","avatar_url":"https://github.com/elliotjreed.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/elliotjreed/database-anonymiser.svg?branch=master)](https://travis-ci.org/elliotjreed/database-anonymiser)\n\n# PHP Database Anonymiser\n\nA library to anonymise datatbase data. For example, anonymising production data for use in development environments.\n\n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.\n\n\n### Prerequisites\n\nThis package requires:\n\n  - PHP 8.0+\n  - [Composer](https://getcomposer.org/)\n\n### Installing\n\nTo install the required dependencies, run:\n\n```bash\ncomposer install\n```\n\n## Running the tests\n\nThere are two test suites defined in [phpunit.xml](phpunit.xml): SQLite and MySQL. The SQLite test suite will run an instance of in-memory SQLite for faster test-driven development and ensuring core functionality. The MYSQL test suite will require a MySQL test database to run, but does account for the slight differences in syntax between SQLite and MySQL (for example, `SHOW TABLES` works in MySQL but not SQLite) - the application itself will account for these differences automatically, but for testing purposes they must be considered independently.\n\nTo run the unit tests and code sniffer checks, run:\n\n```bash\ncomposer run-script test\n```\n\nTo run the unit tests, run:\n\n```bash\ncomposer run-script phpunit\n```\n\nTo run the code sniffer, run:\n\n```bash\ncomposer run-script phpcs\n```\n\n## Usage\n\n### Docker\n\nThis application has a Docker image available at [hub.docker.com/r/elliotjreed/database-anonymiser](https://hub.docker.com/r/elliotjreed/database-anonymiser/).\n\nSee the _Configuration_ section below for details on how to set up the database connection and table configuration.\n\n### Anonymising\n\nTo run the anonymisation application, run:\n\n```bash\ndocker run -v $PWD/config.yml:/app/config.yml elliotjreed/database-anonymiser:latest anonymise /app/config.yml\n```\n\nPlease note: the anonymiser will first check whether all of the tables and columns specified in your configuration file exists. If one or more tables or columns do not exist the application will exit and will provide a message detailing the issue(s). To validate the configuration prior to running the anonymisation application, see below.\n\n### Validating\n\nTo validate the configuration file and ensure all specified tables and columns exists in the database, run:\n\n```bash\ndocker run -v $PWD/config.yml:/app/config.yml elliotjreed/database-anonymiser:latest validate /app/config.yml\n```\n\nTo add the package to a project, add the package as a dependency with Composer. In your `composer.json` file, add:\n\n```json\n\"require\": {\n    \"elliotjreed/database-anonymiser\": \"dev-master\"\n},\n\"repositories\": [\n    {\n        \"type\": \"vcs\",\n        \"url\": \"git@github.com:elliotjreed/database-anonymiser.git\"\n    }\n],\n```\n\n## Configuration\n\nThe application will take either a YAML, JSON, or PHP array configuration file.\n\nThe first section should be the database connection information, taking in a PHP PDO DSN string - currently MySQL and SQLite are supported, although Postgres should work as well.\n\nFor the actual anonymisation configuration you can provide a table name as the key, then either `retain` followed by the number of rows you wish to keep, `remove` followed by the number of rows you wish to remove from the table, or `truncate` to remove all rows from a table.\n\nYou can also specify `columns` you wish to have the values replaced independently or alongside `retain` or `remove`. For each column specify the column name as the key and the value you wish to have the current value replaced with.\n\n```text\ndatabase-connection:\n  dsn: \"mysql:host=localhost;dbname=mydatabasename;charset=utf8;\"\n  username: \"databaseusername\"\n  password: \"databasepassword\"\n  database: \"databasename\"\n\nanonymise:\n  table_a:\n    truncate: true\n\n  table_b:\n    retain: 20\n    columns:\n      column_a: \"Will be replaced with this value\"\n\n  table_c:\n    remove: 30\n    columns:\n      column_a: \"Will be replaced with this value\"\n      column_b: \"Will be replaced with this value\"\n```\n\n## Built With\n\n  - [PHP](https://secure.php.net/)\n  - [PHPUnit](https://phpunit.de/) - Unit Testing\n  - [Composer](https://getcomposer.org/) - Dependency Management\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotjreed%2Fdatabase-anonymiser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felliotjreed%2Fdatabase-anonymiser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felliotjreed%2Fdatabase-anonymiser/lists"}