PHPackages                             arraypress/wp-faker - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. arraypress/wp-faker

ActiveLibrary[Testing &amp; Quality](/categories/testing)

arraypress/wp-faker
===================

A lightweight WordPress library for generating fake data for seeding and testing

04PHP

Since Feb 4Pushed 3mo agoCompare

[ Source](https://github.com/arraypress/wp-faker)[ Packagist](https://packagist.org/packages/arraypress/wp-faker)[ RSS](/packages/arraypress-wp-faker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

WordPress Faker
===============

[](#wordpress-faker)

A lightweight WordPress library for generating fake data for seeding and testing. Built for e-commerce plugins and admin table demos.

Installation
------------

[](#installation)

```
composer require arraypress/wp-faker
```

Quick Start
-----------

[](#quick-start)

```
use ArrayPress\Faker\Fake;

// Generate a customer
$customer = [
    'name'         => Fake::name(),           // "Sarah Johnson"
    'email'        => Fake::email(),           // "sarah.johnson@company.com"
    'phone'        => Fake::phone(),           // "+1 555-234-5678"
    'company'      => Fake::company(),         // "Johnson Technologies"
    'country'      => Fake::country(),         // "us"
    'status'       => Fake::weighted( [ 'active' => 60, 'pending' => 20, 'inactive' => 20 ] ),
    'total_spent'  => Fake::price(),           // 4999 (cents)
    'order_count'  => Fake::number( 1, 50 ),
    'date_created' => Fake::past_date(),       // "2024-03-15 14:22:09"
];
```

API Reference
-------------

[](#api-reference)

### People

[](#people)

```
Fake::first_name();                   // "Sarah"
Fake::last_name();                    // "Johnson"
Fake::name();                         // "Sarah Johnson"
Fake::email();                        // "sarah.johnson@company.com"
Fake::email( 'Sarah', 'Johnson' );    // Consistent email from name
Fake::phone();                        // "+1 555-234-5678"
```

### Companies

[](#companies)

```
Fake::company();                      // "Johnson Technologies"
```

### Commerce

[](#commerce)

```
Fake::price();                        // 4999 (cents, $1–$5,000)
Fake::price( 500, 10000 );            // Custom range in cents
Fake::sku();                          // "PRD-45821"
Fake::product_name();                 // "Premium Widget"
```

### Location

[](#location)

```
Fake::country();                      // "us" (lowercase ISO alpha-2)
```

### Dates

[](#dates)

```
Fake::date_between( '-2 years', 'now' );   // "2024-03-15 14:22:09"
Fake::date_between( '-30 days', 'now' );   // Recent date
Fake::past_date();                          // Random date in last 2 years
Fake::past_date( 365 );                    // Random date in last year
Fake::past_date( 30, 'Y-m-d' );           // Date-only format
```

### Text

[](#text)

```
Fake::sentence();                     // "The customer process would update first."
Fake::sentence( 8 );                  // Exactly 8 words
Fake::paragraph();                    // 3-6 random sentences
Fake::paragraph( 4 );                // Exactly 4 sentences
```

### WordPress

[](#wordpress)

```
Fake::user_id();                      // 42 (random existing user)
Fake::user_id( 'subscriber' );       // Random subscriber
Fake::post_id();                      // 156 (random published post)
Fake::post_id( 'product' );          // Random product post
Fake::attachment_id();                // 89 (random attachment)
Fake::attachment_id( 'image' );      // Random image attachment
Fake::term_id();                      // 12 (random category)
Fake::term_id( 'post_tag' );         // Random tag
```

All WordPress methods return `null` if no matching items exist.

### Utilities

[](#utilities)

```
// Weighted random selection
Fake::weighted( [
    'active'   => 60,
    'pending'  => 20,
    'inactive' => 20,
] );  // "active" (60% of the time)

// Generate multiple items
Fake::many( fn() => Fake::name(), 10 );  // Array of 10 names

// Random number
Fake::number( 1, 100 );              // Random integer

// Random boolean
Fake::boolean();                      // true/false (50/50)
Fake::boolean( 80 );                 // true 80% of the time

// Pick from any array
Fake::random_element( [ 'a', 'b', 'c' ] );  // Random element
```

Seeding Example
---------------

[](#seeding-example)

```
use ArrayPress\Faker\Fake;

// Seed 100 customers
for ( $i = 0; $i < 100; $i++ ) {
    $first = Fake::first_name();
    $last  = Fake::last_name();

    $query->add_item( [
        'name'         => $first . ' ' . $last,
        'email'        => Fake::email( $first, $last ),
        'phone'        => Fake::phone(),
        'company'      => Fake::company(),
        'country'      => Fake::country(),
        'status'       => Fake::weighted( [ 'active' => 60, 'pending' => 20, 'inactive' => 20 ] ),
        'total_spent'  => Fake::price( 5000, 500000 ),
        'order_count'  => Fake::number( 1, 50 ),
        'notes'        => Fake::boolean( 70 ) ? Fake::sentence() : '',
        'date_created' => Fake::past_date(),
    ] );
}
```

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- WordPress 6.2 or later (only for the WordPress methods)

License
-------

[](#license)

GPL-2.0-or-later

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance54

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cd6eb8aff0903d87eb674d1ba3c5f3653899c0d7661504eb0deb7798ed86b643?d=identicon)[arraypress](/maintainers/arraypress)

---

Top Contributors

[![arraypress](https://avatars.githubusercontent.com/u/22668877?v=4)](https://github.com/arraypress "arraypress (1 commits)")

### Embed Badge

![Health badge](/badges/arraypress-wp-faker/health.svg)

```
[![Health](https://phpackages.com/badges/arraypress-wp-faker/health.svg)](https://phpackages.com/packages/arraypress-wp-faker)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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