PHPackages                             bambamboole/extended-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. bambamboole/extended-faker

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

bambamboole/extended-faker
==========================

A FakerPHP extension providing realistic product, category, blog post, and fixture-backed page data across locales.

0.8.0(2mo ago)063.0k↓52.7%1MITPHPPHP ^8.3CI passing

Since Sep 20Pushed 2w agoCompare

[ Source](https://github.com/bambamboole/extended-faker)[ Packagist](https://packagist.org/packages/bambamboole/extended-faker)[ Docs](https://github.com/bambamboole/extended-faker)[ RSS](/packages/bambamboole-extended-faker/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (25)Versions (24)Used By (1)

Extended Faker
==============

[](#extended-faker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2400f111cbd19b85caac39e325b1072bfde9762426788303c413901c36debb0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62616d62616d626f6f6c652f657874656e6465642d66616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bambamboole/extended-faker)[![Total Downloads](https://camo.githubusercontent.com/ba7dd7501df1a0d54c299384eca9bced1587738998e8f506a461fef178d05d49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62616d62616d626f6f6c652f657874656e6465642d66616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bambamboole/extended-faker)[![GitHub Actions](https://github.com/bambamboole/extended-faker/actions/workflows/ci.yml/badge.svg)](https://github.com/bambamboole/extended-faker/actions/workflows/ci.yml/badge.svg)

PHP package extending [FakerPHP/Faker](https://github.com/FakerPHP/Faker) with realistic product, category, blog post, page, customer, and supplier data. Products are generated from compositional templates (effectively unlimited, trademark-free). Provides 24 categories, 12 fixture-backed pages, and **dynamically generates 1000+ unique blog posts** with localized content across English (en\_US) and German (de\_DE).

Features
--------

[](#features)

- **Cross-language consistency**: Same identifiers across locales with localized content
- **Multiple data types**: Products, categories, blog posts, and pages
- **Dynamic blog post generation**: Compositional template system generates 1000+ unique blog posts
- **Markdown blog posts**: Professional content with headings, code blocks, and rich formatting
- **Fixture-backed pages**: Named pages composed of structured Content blocks, renderable to Markdown or WordPress block markup
- **Realistic data**: Synthetic, trademark-free product names, descriptions, categories, and dynamically composed articles
- **Deterministic generation**: Same seed produces same blog post for reproducible testing
- **Generative customers &amp; suppliers**: Deterministic private customers, company customers, and suppliers with round-trippable, country-prefixed numbers (DE/US data)
- **Units &amp; prices**: Every product carries a structured unit (`2.5 l`, `500-pack`, `25 kg`) and a deterministic price (integer minor units, USD/EUR by locale)
- **Extensible**: Easy to add new data via JSON template files

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

[](#installation)

```
composer require bambamboole/extended-faker
```

Usage
-----

[](#usage)

### Products

[](#products)

Products are generated deterministically from compositional templates, so `$faker->unique()->product()` yields effectively unlimited unique products (synthetic, trademark-free names like "Voltari Pulse 7 Pro 256GB Graphite").

```
use Faker\Factory;
use Bambamboole\ExtendedFaker\Providers\en_US\Product;

$faker = Factory::create('en_US');
$faker->addProvider(new Product($faker));

$product = $faker->product();              // random ProductDto
$product = $faker->generateProduct(42);    // deterministic by seed
$same    = $faker->productBySku($product->sku); // round-trips to the same product
$de      = $faker->getProductInLocale($product->sku, 'de_DE'); // same SKU, localized

$product->unitAmount;       // 2.5
$product->unit;             // "l"
$product->price->amount;    // 2499 (minor units)
$product->price->currency;  // "USD" (en_US) / "EUR" (de_DE)
```

Material categories for construction-site data — Paint &amp; Coatings, Construction Wood, Concrete &amp; Mortar, Fasteners, and Electrical Supplies — generate products with trade-appropriate units (liters, kg bags, packs, cable by the meter). The same SKU yields the same name, unit, and price amount in every locale; only the currency and description are localized.

### Customers &amp; Suppliers

[](#customers--suppliers)

Private customers, company customers, and suppliers are generated deterministically like products. The number encodes the country and seed (`CUS-DE-16`), so the same number always resolves to the identical entity — from any locale. `de_DE` fakers generate German data (names, addresses, +49 phones, valid IBANs, DE VAT ids), `en_US` fakers generate US data (EIN-style tax ids, no IBAN). All emails use RFC-2606-reserved domains — private customers on `example.com/org/net`, companies and their contacts on the company's own `.example.com` domain — and company names are synthetic and trademark-free.

```
use Bambamboole\ExtendedFaker\ExtendedFaker;
use Faker\Factory;

$faker = Factory::create('de_DE');
ExtendedFaker::extend($faker, 'de_DE');

// Private customers (B2C persons)
$customer = $faker->privateCustomer();               // random PrivateCustomerDto
$customer = $faker->generatePrivateCustomer(42);     // deterministic by seed
$same     = $faker->privateCustomerByNumber($customer->number);
$customer->salutation;                               // Salutation enum ('mr'|'mrs'|'neutral'), always
                                                     // consistent with the first name's gender
$customer->academicTitle;                            // null | "Dr." | "Prof. Dr."
$customer->mobile;                                   // "+49 171 2345678" (distinct from phone)

// Company customers (B2B)
$company = $faker->companyCustomer();                // CompanyCustomerDto with VAT id, website, mobile,
                                                     // German tax number (DE only) and 0-5 contacts
$company->contacts;                                  // list: salutation, first/last name,
                                                     // email, phone, role (ContactRole enum)

// Suppliers (companies plus payment terms and supplied product categories)
$supplier = $faker->supplier();
$supplier->paymentTerms;                             // "net 30"
$supplier->suppliedCategories;                       // ["electronics", "furniture"]
```

### Categories

[](#categories)

```
use Bambamboole\ExtendedFaker\Providers\en_US\Category;

$faker->addProvider(new Category($faker));

$category = $faker->category();          // Random category
$categoryName = $faker->categoryName();  // "Electronics"
```

### Blog Posts

[](#blog-posts)

```
use Bambamboole\ExtendedFaker\Providers\en_US\BlogPost;

$faker->addProvider(new BlogPost($faker));

// Random blog post (dynamically generated)
$post = $faker->blogPost();
// BlogPostDto with title, content, excerpt, tags, author, etc.

// Specific blog post methods
$title = $faker->blogPostTitle();        // "Getting Started with Docker in 2024"
$content = $faker->blogPostContent();    // Full markdown content
$excerpt = $faker->blogPostExcerpt();    // Short summary
$tags = $faker->blogPostTags();          // ["docker", "devops", "containers"]
$author = $faker->blogPostAuthor();      // "Michael Chen"
$category = $faker->blogPostCategory();  // "technology"
$readingTime = $faker->blogPostReadingTime(); // 2 (minutes)

// Get post by dynamically generated slug
$slug = $post->slug;
$retrievedPost = $faker->blogPostBySlug($slug);

// Cross-locale blog posts work with any generated slug
$enPost = $faker->blogPost();
$dePost = $faker->getBlogPostInLocale($enPost->slug, 'de_DE');
```

### Pages

[](#pages)

```
use Bambamboole\ExtendedFaker\Providers\en_US\Page;
use Bambamboole\ExtendedFaker\Page\PageType;

$faker->addProvider(new Page($faker));

// Named fixture-backed page
$page = $faker->page('about');
// PageDto with title, slug, content blocks, excerpt, template, seo, etc.

// Typed page lookup
$pricing = $faker->page(PageType::Pricing);
$about = $faker->pageByType(PageType::About);

// Render page content
$content = $faker->pageContent('about');      // Markdown content
$blocks = $faker->pageBlockContent('about');  // WordPress block markup
$seo = $faker->pageSeo('about');              // SEO title and description

// Cross-locale pages work with shared slugs
$dePage = $faker->getPageInLocale($page->slug, 'de_DE');
$aboutPage = $faker->pageBySlug('about', 'en_US');
```

### Using ExtendedFaker Helper

[](#using-extendedfaker-helper)

For convenience, use the `ExtendedFaker::extend()` method to register all providers at once:

```
use Faker\Factory;
use Bambamboole\ExtendedFaker\ExtendedFaker;

// Automatically registers Product, Category, BlogPost, and Page providers
$faker = Factory::create('en_US');
ExtendedFaker::extend($faker, 'en_US');

// Now use any provider
$product = $faker->product();
$category = $faker->category();
$blogPost = $faker->blogPost();
$page = $faker->page();

// German locale
$fakerDe = Factory::create('de_DE');
ExtendedFaker::extend($fakerDe, 'de_DE');
```

Available Methods
-----------------

[](#available-methods)

### Product Provider

[](#product-provider)

- `productName(?string $identifier = null): string`
- `productDescription(?string $identifier = null): string`
- `productCategory(?string $identifier = null): string`
- `product(?string $identifier = null): ProductDto`
- `generateProduct(int $seed, ?string $category = null, ?string $locale = null): ProductDto`
- `productBySku(string $sku, ?string $locale = null): ProductDto`
- `getProductInLocale(string $sku, string $locale): ProductDto`

### Category Provider

[](#category-provider)

- `categoryName(?string $identifier = null): string`
- `category(?string $identifier = null): array`

### BlogPost Provider

[](#blogpost-provider)

- `blogPostTitle(?string $identifier = null): string`
- `blogPostContent(?string $identifier = null): string`
- `blogPostExcerpt(?string $identifier = null): string`
- `blogPostCategory(?string $identifier = null): string`
- `blogPostTags(?string $identifier = null): array`
- `blogPostAuthor(?string $identifier = null): string`
- `blogPostReadingTime(?string $identifier = null): int`
- `blogPost(?string $identifier = null): BlogPostDto`
- `blogPostBySlug(string $slug, ?string $locale = null): BlogPostDto`
- `getBlogPostSlug(string $title): string`
- `getBlogPostInLocale(string $slug, string $locale): BlogPostDto`

### Page Provider

[](#page-provider)

- `pageTitle(string|PageType|null $identifier = null): string`
- `pageContent(string|PageType|null $identifier = null): string`
- `pageBlockContent(string|PageType|null $identifier = null, ?WordPressBlockOptions $options = null): string`
- `pageExcerpt(string|PageType|null $identifier = null): string`
- `pageTemplate(string|PageType|null $identifier = null): string`
- `pageSeo(string|PageType|null $identifier = null): array`
- `page(string|PageType|null $identifier = null): PageDto`
- `pageByType(PageType $page, ?string $locale = null): PageDto`
- `pageBySlug(string $slug, ?string $locale = null): PageDto`
- `getPageSlug(string $title): string`
- `getPageInLocale(string $slug, string $locale): PageDto`

Data Structure
--------------

[](#data-structure)

Categories and pages are stored as JSON files. Products and blog posts are dynamically generated from composable templates:

```
resources/
├── categories/
│   ├── cell-phones-smartphones.json
│   ├── electronics.json
│   └── ...
├── pages/
│   ├── about.json
│   ├── contact.json
│   └── ...
└── blog-templates/
    ├── titles.json              // Title patterns by category
    ├── introductions.json       // Opening paragraph templates
    ├── sections.json            // Body content blocks by category
    ├── conclusions.json         // Closing paragraph templates
    ├── code-examples.json       // Code snippets for tech posts
    └── metadata.json            // Authors, tags, topics, dates

```

### Blog Post Generation

[](#blog-post-generation)

Blog posts are **dynamically generated** using a compositional template system that mixes and matches components:

- **1000+ unique combinations** from template patterns
- **Deterministic generation**: Same seed always produces the same post
- **Category-specific content**: Technology, Business, Travel, Lifestyle
- **Automatic slug generation** from titles
- **Reading time calculation** based on word count (200 words/minute)
- **3-5 minute reads**: Short, focused blog posts (150-350 words)

**Available Categories:** Technology, Business, Travel, Lifestyle

Each generated post includes:

- Unique title and slug
- Category-appropriate introduction
- 4-5 content sections
- Conclusion
- 3-5 relevant tags
- Random author name
- Published date (2023-2024)
- Calculated reading time
- Optional code examples (technology posts)

Fixture Images
--------------

[](#fixture-images)

Every product, category, and page exposes a small, copyright-safe **comic image**(bold-outline SVG rasterized to WebP, committed under `resources/images/`).

```
$faker->productImageDto();              // ImageDto -> images/products/{category}/{n}.webp
$faker->productImage();                 // path, e.g. "images/products/cell-phones-smartphones/3.webp"
$faker->category()['image'];            // "images/categories/electronics.webp"
$faker->page('about')->image;           // "images/pages/about.webp"
$faker->pageImage('about');             // same path
```

Each generated product gets a committed WebP matching its **category and colour**: every category's comic motif is rendered in each palette, and a product points to the palette that matches its colour (so products sharing a category and colour share an image). The `ImageDto` exposes the relative path plus the resolved absolute path and file metadata. The shipped package only reads the committed WebP files. To regenerate the set, run `npm install && composer images:build` — rasterization uses Node + [sharp](https://sharp.pixelplumbing.com). See the `creating-fixture-images` skill for the motif system.

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

[](#requirements)

- PHP 8.3+
- fakerphp/faker ^1.24
- league/commonmark ^2.7
- symfony/yaml ^7.3

Testing
-------

[](#testing)

```
composer test            # run the test suite
composer test:coverage   # run with coverage
composer test:lint       # check code style (Pint)
composer analyse         # static analysis (PHPStan)
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Manuel Christlieb](https://github.com/bambamboole)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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

Every ~27 days

Recently: every ~8 days

Total

11

Last Release

65d ago

PHP version history (2 changes)0.1.0PHP &gt;=8.2.0

0.6.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/547137a6d80cad01ed1dd065b1c6af329d9a23a4134a895cff01e078cc155500?d=identicon)[bambamboole](/maintainers/bambamboole)

---

Top Contributors

[![bambamboole](https://avatars.githubusercontent.com/u/8823695?v=4)](https://github.com/bambamboole "bambamboole (96 commits)")

---

Tags

testingfakerfixturesseedingbambamboolefakerphp

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bambamboole-extended-faker/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[statamic/cms

The Statamic CMS Core Package

4.9k3.8M1.2k](/packages/statamic-cms)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k43.6M45.9k](/packages/orchestra-testbench)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8221.5M92](/packages/orchestra-workbench)[jason-munro/cypht

Lightweight Open Source webmail written in PHP and JavaScript

1.7k160.6k](/packages/jason-munro-cypht)[contao/core-bundle

Contao Open Source CMS

1301.7M3.1k](/packages/contao-core-bundle)

PHPackages © 2026

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