PHPackages                             mlambley/swagfaker - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mlambley/swagfaker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mlambley/swagfaker
==================

Create fake data from a Swagger schema

1.0.1(5y ago)06.4k[1 issues](https://github.com/mlambley/swagfaker/issues)[3 PRs](https://github.com/mlambley/swagfaker/pulls)MITPHP

Since Aug 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mlambley/swagfaker)[ Packagist](https://packagist.org/packages/mlambley/swagfaker)[ RSS](/packages/mlambley-swagfaker/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (7)Used By (0)

Swagfaker
=========

[](#swagfaker)

Generates fake data which will validate against your Swagger 2.0 schema.

How to install
--------------

[](#how-to-install)

```
composer require mlambley/swagfaker:^1.0

```

What is Swagger?
----------------

[](#what-is-swagger)

Swagger 2.0 (aka Open API 2.0) defines the structure of your API, including end points and the structure of input and output data. See [their website](https://swagger.io/) for more information.

What is Swagfaker?
------------------

[](#what-is-swagfaker)

Swagfaker allows you to generate fake data based upon your existing Swagger 2.0 specification. You can use it to generate data to be sent to your API during acceptance testing.

Example
-------

[](#example)

Let's say your Swagger schema looks like this:

```
{
  "type": "object",
  "required": [
    "Name",
    "DateOfBirth",
    "Identifier",
    "VisitCount"
  ],
  "properties": {
    "Name": {
      "type": "string"
    },
    "DateOfBirth": {
      "type": "string",
      "format": "date"
    },
    "Identifier": {
      "type": "string",
      "pattern": "^[0-9]{3}-[0-9]{4}$"
    },
    "VisitCount": {
      "type": "integer",
      "minimum": 0
    }
  }
}
```

Then generate fake data using:

```
$values = (new \SwaggerFaker\Faker())->generate($schema);
```

Your values now might look like this:

```
object(stdClass) {
  "Name" => "Quod."
  "DateOfBirth" => "1971-08-20"
  "Identifier" => "037-1259"
  "VisitCount" => 1463093889
}

```

Issues?
-------

[](#issues)

Log a [github issue](https://github.com/mlambley/swagfaker/issues). Your assistance is appreciated.

Credit
------

[](#credit)

Give some love to [Leko](https://github.com/Leko) for their [JSON Schema Faker](https://github.com/Leko/php-json-schema-faker) which this library was originally copied from.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~403 days

Total

3

Last Release

2111d ago

Major Versions

0.0.1-alpha.1 → 1.02018-08-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17264636?v=4)[Mark Lambley](/maintainers/mlambley)[@mlambley](https://github.com/mlambley)

---

Top Contributors

[![mlambley](https://avatars.githubusercontent.com/u/17264636?v=4)](https://github.com/mlambley "mlambley (2 commits)")[![mark-lambley-simpro](https://avatars.githubusercontent.com/u/24515999?v=4)](https://github.com/mark-lambley-simpro "mark-lambley-simpro (1 commits)")

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/mlambley-swagfaker/health.svg)

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

###  Alternatives

[bheller/images-generator

Generator of placeholder images for Faker

573.1M3](/packages/bheller-images-generator)[digilist/snakedumper

4946.0k](/packages/digilist-snakedumper)[swekaj/cron-expression-generator

Generate valid cron expressions.

1169.8k1](/packages/swekaj-cron-expression-generator)[hydreflab/jedi-faker

Faker extension for Star Wars junkie

1430.8k1](/packages/hydreflab-jedi-faker)[gourmet/faker

Faker support for CakePHP 3

189.5k1](/packages/gourmet-faker)[andrefigueira/blog-article-faker

Generate random blog article titles and content (including markdown) using faker

1415.0k](/packages/andrefigueira-blog-article-faker)

PHPackages © 2026

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