{"id":15003375,"url":"https://github.com/dummify/dummify.php","last_synced_at":"2026-03-18T01:05:42.777Z","repository":{"id":56973216,"uuid":"111016957","full_name":"dummify/dummify.php","owner":"dummify","description":"Programmatically dummifies your database to non-sensitive data for development use!","archived":false,"fork":false,"pushed_at":"2017-12-09T19:32:23.000Z","size":136,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T14:22:35.172Z","etag":null,"topics":["database","dummy","dummy-data","fake-data","faker","mysql","php","sensitive-data","sql-server"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dummify.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-16T20:08:50.000Z","updated_at":"2019-09-22T05:23:08.000Z","dependencies_parsed_at":"2022-08-21T07:10:20.034Z","dependency_job_id":null,"html_url":"https://github.com/dummify/dummify.php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dummify%2Fdummify.php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dummify%2Fdummify.php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dummify%2Fdummify.php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dummify%2Fdummify.php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dummify","download_url":"https://codeload.github.com/dummify/dummify.php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243154769,"owners_count":20244988,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["database","dummy","dummy-data","fake-data","faker","mysql","php","sensitive-data","sql-server"],"created_at":"2024-09-24T18:58:09.347Z","updated_at":"2025-12-27T04:47:53.338Z","avatar_url":"https://github.com/dummify.png","language":"PHP","readme":"## Dummify.php\n\n\u003e Programmatically dummifies your database to non-sensitive data for development use!\n\n[![Build Status](https://travis-ci.org/dummify/dummify.php.svg?branch=master)](https://travis-ci.org/dummify/dummify.php) [![StyleCI](https://styleci.io/repos/111016957/shield?branch=master)](https://styleci.io/repos/111016957) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dummify/dummify.php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dummify/dummify.php/?branch=master)\n\n### TL;DR\n\n```php\n// Use an array of parameters to connect to a database\n$connection = ['driver' =\u003e 'sqlite', 'database' =\u003e ':memory:'];\n\n// You may populate your database with dummy data\n$faker = Faker\\Factory::create();\n\nDummify::connectTo($connection)\n-\u003efrom('users')\n-\u003einsert(function($row) {\n  $row-\u003ename = $faker-\u003ename;\n  $row-\u003eemail = $faker-\u003eemail;\n  return $row;\n});\n\n// Or you can dummify with a new rule\nDummify::connectTo($connection)\n-\u003efrom('users', function ($query) {\n  return $query-\u003ewhere('email', 'email@dummify.php'); // (Optional)\n})\n-\u003eupdate(function ($row) {\n  $row-\u003eemail = 'email2@dummify.php';\n  return $row;\n})\n```\n\n### Install Dummify\n\nThanks to [Composer](https://getcomposer.org/) it is quite easy!\n\n```bash\n$ composer require --dev dummify/dummify.php\n```\n\nAnd on your code:\n\n```php\ninclude '/vendor/autoload.php';\n\nuse Dummify\\Dummify;\n```\n\n### Setup a connection\n\nUsing [`Illuminate\\Database`](https://github.com/illuminate/database) capsule for database connections, `Dummify` can connect to:\n- MySQL\n- PostgreSQL\n- SQL Server\n- SQLite\n\nTo create a new connection you need an array of parameters like this one:\n\n##### MySQL/MariaDB connection\n\nThere is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L42)!\n\n```php\n$connection = [\n  'driver' =\u003e 'mysql',\n  'host' =\u003e '127.0.0.1',\n  'port' =\u003e '3306',\n  'database' =\u003e 'example',\n  'username' =\u003e 'root',\n  'password' =\u003e '',\n  'unix_socket' =\u003e '',\n  'charset' =\u003e 'utf8mb4',\n  'collation' =\u003e 'utf8mb4_unicode_ci',\n  'prefix' =\u003e '',\n  'strict' =\u003e true,\n  'engine' =\u003e null,\n];\n```\n\n##### PostgreSQL connection\n\nThere is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L57)!\n\n```php\n$connection = [\n  'driver' =\u003e 'pgsql',\n  'host' =\u003e '127.0.0.1',\n  'port' =\u003e '5432',\n  'database' =\u003e 'example',\n  'username' =\u003e 'root',\n  'password' =\u003e '',\n  'charset' =\u003e 'utf8',\n  'prefix' =\u003e '',\n  'schema' =\u003e 'public',\n  'sslmode' =\u003e 'prefer',\n];\n```\n\n##### SQL Server connection\n\nThere is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L70)!\n\n```php\n$connection = [\n  'driver' =\u003e 'sqlsrv',\n  'host' =\u003e '127.0.0.1'),\n  'port' =\u003e '1433',\n  'database' =\u003e 'example',\n  'username' =\u003e 'root',\n  'password' =\u003e '',\n  'charset' =\u003e 'utf8',\n  'prefix' =\u003e '',\n];\n```\n\n##### SQLite connection\n\nThere is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L36)!\n\n```php\n$connection = [\n  'driver' =\u003e 'sqlite',\n  'database' =\u003e '/static/path/to/database.sqlite',\n  'prefix' =\u003e '',\n];\n```\n\nOr you can use in memory connection like this:\n\n```php\n$connection = [\n  'driver' =\u003e 'sqlite',\n  'database' =\u003e ':memory:',\n  'prefix' =\u003e '',\n];\n```\n\n### Instantiate a Dummify\n\nOnce you have your connection array you can connect into your database using:\n\n```php\n$dummify = Dummify::connectTo($connection)\n```\n\nLater you may choose a table using the `from($table)` method.\n\n```php\n$dummify-\u003efrom('users')\n```\n\n### Populate a table with dummy data\n\nYou may populate a table using the `insert(callable $callable, $iterations = 1)` method. In this case we are using \n[Faker](https://github.com/fzaninotto/Faker) to help us generate random data!\n\n```php\n$faker = Faker\\Factory::create();\n\n$dummify\n  -\u003efrom('users')\n  -\u003einsert(function($row){\n    $row-\u003ename = $faker-\u003ename\n    $row-\u003eemail = $faker-\u003eemail\n    return $row;\n  });\n\n// (Optional) You can pass how many you want to create\n$dummify\n  -\u003efrom('users')\n  -\u003einsert(function($row){\n    $row-\u003ename = $faker-\u003ename\n    $row-\u003eemail = $faker-\u003eemail\n    return $row;\n  }, 100);\n```\n\n### Update a table with dummy data\n\nYou may setup how the iterator will work over each line using the `update(callable $callable)` method!\n\n\n```php\n$faker = Faker\\Factory::create();\n\n$dummify\n  -\u003efrom('users')\n  -\u003eupdate(function($row){\n    $row-\u003ename = $faker-\u003ename\n    $row-\u003eemail = $faker-\u003eemail\n    return $row\n  });\n```\n\n#### Making restrictions for updates\nIf you are interested on limiting or adding conditions to your SQL query, you can use all `Illuminate\\Database` fluent syntax!\n\nFor more docs about it follow-up with `Laravel` [docs](https://laravel.com/docs/queries);\n\n```php\n$dummify-\u003efrom('users', function($query) {\n  return $query-\u003ewhere('name', 'like', '%Filipe%');\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdummify%2Fdummify.php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdummify%2Fdummify.php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdummify%2Fdummify.php/lists"}