PHPackages                             dummify/dummify.php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. dummify/dummify.php

ActiveLibrary[Database &amp; ORM](/categories/database)

dummify/dummify.php
===================

1.0.0(8y ago)310MITPHP

Since Dec 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dummify/dummify.php)[ Packagist](https://packagist.org/packages/dummify/dummify.php)[ RSS](/packages/dummify-dummifyphp/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Dummify.php
-----------

[](#dummifyphp)

> Programmatically dummifies your database to non-sensitive data for development use!

[![Build Status](https://camo.githubusercontent.com/815c7240210748135557605f0d76e2105e3085482ebb6fcfc44af8bf7accd86e/68747470733a2f2f7472617669732d63692e6f72672f64756d6d6966792f64756d6d6966792e7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dummify/dummify.php) [![StyleCI](https://camo.githubusercontent.com/e84d9c61ba175af8e7b8e6e9849a2c407a1fe23520edad8486d3c95859fca0e4/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131313031363935372f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/111016957) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/ff6e31ebc564dc89e746d71072ed90d3b2801fc433fca331d92d1a9dea4281d2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64756d6d6966792f64756d6d6966792e7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/dummify/dummify.php/?branch=master)

### TL;DR

[](#tldr)

```
// Use an array of parameters to connect to a database
$connection = ['driver' => 'sqlite', 'database' => ':memory:'];

// You may populate your database with dummy data
$faker = Faker\Factory::create();

Dummify::connectTo($connection)
->from('users')
->insert(function($row) {
  $row->name = $faker->name;
  $row->email = $faker->email;
  return $row;
});

// Or you can dummify with a new rule
Dummify::connectTo($connection)
->from('users', function ($query) {
  return $query->where('email', 'email@dummify.php'); // (Optional)
})
->update(function ($row) {
  $row->email = 'email2@dummify.php';
  return $row;
})
```

### Install Dummify

[](#install-dummify)

Thanks to [Composer](https://getcomposer.org/) it is quite easy!

```
$ composer require --dev dummify/dummify.php
```

And on your code:

```
include '/vendor/autoload.php';

use Dummify\Dummify;
```

### Setup a connection

[](#setup-a-connection)

Using [`Illuminate\Database`](https://github.com/illuminate/database) capsule for database connections, `Dummify` can connect to:

- MySQL
- PostgreSQL
- SQL Server
- SQLite

To create a new connection you need an array of parameters like this one:

##### MySQL/MariaDB connection

[](#mysqlmariadb-connection)

There is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L42)!

```
$connection = [
  'driver' => 'mysql',
  'host' => '127.0.0.1',
  'port' => '3306',
  'database' => 'example',
  'username' => 'root',
  'password' => '',
  'unix_socket' => '',
  'charset' => 'utf8mb4',
  'collation' => 'utf8mb4_unicode_ci',
  'prefix' => '',
  'strict' => true,
  'engine' => null,
];
```

##### PostgreSQL connection

[](#postgresql-connection)

There is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L57)!

```
$connection = [
  'driver' => 'pgsql',
  'host' => '127.0.0.1',
  'port' => '5432',
  'database' => 'example',
  'username' => 'root',
  'password' => '',
  'charset' => 'utf8',
  'prefix' => '',
  'schema' => 'public',
  'sslmode' => 'prefer',
];
```

##### SQL Server connection

[](#sql-server-connection)

There is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L70)!

```
$connection = [
  'driver' => 'sqlsrv',
  'host' => '127.0.0.1'),
  'port' => '1433',
  'database' => 'example',
  'username' => 'root',
  'password' => '',
  'charset' => 'utf8',
  'prefix' => '',
];
```

##### SQLite connection

[](#sqlite-connection)

There is an [example here](https://github.com/laravel/laravel/blob/master/config/database.php#L36)!

```
$connection = [
  'driver' => 'sqlite',
  'database' => '/static/path/to/database.sqlite',
  'prefix' => '',
];
```

Or you can use in memory connection like this:

```
$connection = [
  'driver' => 'sqlite',
  'database' => ':memory:',
  'prefix' => '',
];
```

### Instantiate a Dummify

[](#instantiate-a-dummify)

Once you have your connection array you can connect into your database using:

```
$dummify = Dummify::connectTo($connection)
```

Later you may choose a table using the `from($table)` method.

```
$dummify->from('users')
```

### Populate a table with dummy data

[](#populate-a-table-with-dummy-data)

You may populate a table using the `insert(callable $callable, $iterations = 1)` method. In this case we are using [Faker](https://github.com/fzaninotto/Faker) to help us generate random data!

```
$faker = Faker\Factory::create();

$dummify
  ->from('users')
  ->insert(function($row){
    $row->name = $faker->name
    $row->email = $faker->email
    return $row;
  });

// (Optional) You can pass how many you want to create
$dummify
  ->from('users')
  ->insert(function($row){
    $row->name = $faker->name
    $row->email = $faker->email
    return $row;
  }, 100);
```

### Update a table with dummy data

[](#update-a-table-with-dummy-data)

You may setup how the iterator will work over each line using the `update(callable $callable)` method!

```
$faker = Faker\Factory::create();

$dummify
  ->from('users')
  ->update(function($row){
    $row->name = $faker->name
    $row->email = $faker->email
    return $row
  });
```

#### Making restrictions for updates

[](#making-restrictions-for-updates)

If you are interested on limiting or adding conditions to your SQL query, you can use all `Illuminate\Database` fluent syntax!

For more docs about it follow-up with `Laravel` [docs](https://laravel.com/docs/queries);

```
$dummify->from('users', function($query) {
  return $query->where('name', 'like', '%Filipe%');
});
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3073d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e3e44d2d781008639c5fb3844db8d73a5901ee1f6afd0a2f2144449759d139f?d=identicon)[filipeforattini](/maintainers/filipeforattini)

---

Top Contributors

[![filipeforattini](https://avatars.githubusercontent.com/u/2805436?v=4)](https://github.com/filipeforattini "filipeforattini (55 commits)")

---

Tags

databasedummydummy-datafake-datafakermysqlphpsensitive-datasql-server

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dummify-dummifyphp/health.svg)

```
[![Health](https://phpackages.com/badges/dummify-dummifyphp/health.svg)](https://phpackages.com/packages/dummify-dummifyphp)
```

###  Alternatives

[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[staudenmeir/eloquent-json-relations

Laravel Eloquent relationships with JSON keys

1.1k5.8M24](/packages/staudenmeir-eloquent-json-relations)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.1M11](/packages/bavix-laravel-wallet)[dragon-code/migrate-db

Easy data transfer from one database to another

15717.4k](/packages/dragon-code-migrate-db)[gearbox-solutions/eloquent-filemaker

A package for getting FileMaker records as Eloquent models in Laravel

6454.8k2](/packages/gearbox-solutions-eloquent-filemaker)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
