PHPackages                             vgirol/jsonapi-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. [API Development](/categories/api)
4. /
5. vgirol/jsonapi-faker

AbandonedArchivedLibrary[API Development](/categories/api)

vgirol/jsonapi-faker
====================

This package provides a factory to generate fake data using the JSON:API specification.

v1.3.0(5y ago)04172MITPHPPHP ^7.3|^8.0

Since Aug 21Pushed 5y ago1 watchersCompare

[ Source](https://github.com/VGirol/JsonApi-Faker)[ Packagist](https://packagist.org/packages/vgirol/jsonapi-faker)[ Docs](http://github.com/VGirol/JsonApi-Faker)[ RSS](/packages/vgirol-jsonapi-faker/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (6)Versions (12)Used By (2)

JsonApi-Faker
=============

[](#jsonapi-faker)

[![Latest Version on Packagist](https://camo.githubusercontent.com/29aa24b7a15ccb89b8052175e1cdea701a9076e1ac0e61c784cc0cdc19c8bead/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f564769726f6c2f4a736f6e4170692d46616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/VGirol/JsonApi-Faker)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/337b563f573efcf03eebc2f1d5d6ad5b72e4809ee80298ab62a1df74ac82198b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f564769726f6c2f4a736f6e4170692d46616b65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/VGirol/JsonApi-Faker)[![Coverage Status](https://camo.githubusercontent.com/849931d285e87fb7c2a9d2ce4053c7d025f35155c1c4b287cd6e13b825c0b0db/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f564769726f6c2f4a736f6e4170692d46616b65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/VGirol/JsonApi-Faker/code-structure)[![Quality Score](https://camo.githubusercontent.com/3e0e049e12cb40056e90443fb3cc63ca357c5a72343031cd60f8a3cc57928585/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f564769726f6c2f4a736f6e4170692d46616b65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/VGirol/JsonApi-Faker)[![Infection MSI](https://camo.githubusercontent.com/1f3b5741ee116f9b97dd380fad57819bb51a096dbdb0cf091c909d3e4417eda4/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742d7371756172652675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d253246564769726f6c2532464a736f6e4170692d46616b65722532466d6173746572)](https://dashboard.stryker-mutator.io/reports/github.com/VGirol/JsonApi-Faker/master)[![Total Downloads](https://camo.githubusercontent.com/b5e6cdf6872a6f57cf280b2b14652252d7aad0b7ff5b24411740c142575e100f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f564769726f6c2f4a736f6e4170692d46616b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/VGirol/JsonApi-Faker)

This package provides a set of factories to build fake data using the [JSON:API specification](https://jsonapi.org/).

Technologies
------------

[](#technologies)

- PHP 7.3+

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

[](#installation)

To install through composer, simply put the following in your `composer.json` file:

```
{
    "require-dev": {
        "vgirol/jsonapi-faker": "dev-master"
    }
}
```

And then run `composer install` from the terminal.

### Quick Installation

[](#quick-installation)

Above installation can also be simplified by using the following command:

```
composer require vgirol/jsonapi-faker
```

Usage
-----

[](#usage)

First create a faker generator.

```
use VGirol\JsonApiFaker\Generator as JsonApiFaker;

$faker = new JsonApiFaker;
```

Then create a factory.

```
$factory = $faker->resourceObject();
```

Next you can fill the factory ...

```
$factory->setResourceType('test')
        ->setId('1')
        ->setAttributes([
            'attr1' => 'value1',
            'attr2' => 'value2'
        ])
        ->setMeta([
            'key1' => 'meta1'
        ])
        ->addLink('self', 'url');
```

... or generate a fake.

```
$factory->fake();
```

Finally export as an array or as JSON.

```
$array = $factory->toArray();
$json = $factory->toJson();
```

All these instructions can be chained.

```
use VGirol\JsonApiFaker\Generator as JsonApiFaker;

$json = new JsonApiFaker()
    ->resourceObject()
    ->fake()
    ->toJson();
```

Documentation
-------------

[](#documentation)

The API documentation is available in XHTML format at the url .

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Girol Vincent](https://github.com/VGirol)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

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

Every ~59 days

Recently: every ~89 days

Total

11

Last Release

1866d ago

PHP version history (3 changes)v1.0.0PHP ^7.2

v1.1.1PHP ^7.3

v1.3.0PHP ^7.3|^8.0

### Community

Maintainers

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

---

Top Contributors

[![VGirol](https://avatars.githubusercontent.com/u/18059718?v=4)](https://github.com/VGirol "VGirol (206 commits)")

---

Tags

JSON-APIFake datavgiroljsonapi-faker

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vgirol-jsonapi-faker/health.svg)

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

###  Alternatives

[neomerx/json-api

Framework agnostic JSON API (jsonapi.org) implementation

7373.6M27](/packages/neomerx-json-api)[cloudcreativity/laravel-json-api

JSON API (jsonapi.org) support for Laravel applications.

7881.1M5](/packages/cloudcreativity-laravel-json-api)[laravel-json-api/laravel

JSON:API for Laravel applications.

6371.4M15](/packages/laravel-json-api-laravel)[timacdonald/json-api

A Lightweight JSON:API Resource for Laravel

639892.5k2](/packages/timacdonald-json-api)[art4/json-api-client

JSON API client

139791.3k7](/packages/art4-json-api-client)[friendsofcake/crud-json-api

Listener for building CakePHP Crud APIs following the JSON API specification.

58445.4k3](/packages/friendsofcake-crud-json-api)

PHPackages © 2026

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