PHPackages                             alnutile/fixtures - 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. alnutile/fixtures

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

alnutile/fixtures
=================

Help with saving and getting JSON files for testing APIs

0.0.4(3y ago)08.1k↓50%1MITPHPPHP ^8.1

Since Feb 1Pushed 2y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (12)Versions (5)Used By (1)

Fixture Getter and Setter for API or DTO testing
================================================

[](#fixture-getter-and-setter-for-api-or-dto-testing)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fefa6e8695faecd69612f34d547e50a49d7ea7b241ba16d249519da2a1a5bf3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6e7574696c652f66697874757265732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alnutile/fixtures)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6bace5c632b45dd09dc9feb8303407a85fcd87692947f34a7cd608b89e598b64/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6e7574696c652f66697874757265732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/alnutile/fixtures/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/5aa09b5c39c8a11f9abad8c9765ed79a156f2916a0b0a12acc9b21ce617d5602/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6e7574696c652f66697874757265732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/alnutile/fixtures/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/68236f2939ecafd8b410ebe5c654e6df7c7503db273de5cbba4a443647e53f9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c6e7574696c652f66697874757265732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alnutile/fixtures)

TL;DR
-----

[](#tldr)

For writing tests and mocking Http responses using files saved in my `tests/fixtures` folder. Yes some people hit the real API and this has it's place but when working with APIs it is nice and faster not to hit the API for a lot of reasons.

[![](logo.png)](logo.png)

Overview
--------

[](#overview)

For all my projects that talk to APIs I will save copies of the API results to my tests folder and use that data to test against.

For example if I GET "" and get back:

```
{
    "baz": "boo"
}
```

Then I save that as a file to my `tests/fixtures/foo_get_response.json`

Then in my test I will mock it with Http or other tool

```
$data = get_fixture('foo_get_response.json')
Http::fake(
    [
        'foo.com/*' => Http::response($data, 200)
    ]
);
```

Before I had this helper I would have to write this all out:

```
$data = File::get(base_path(sprintf(
            'tests/fixtures/%s',
            $file_name
        )));

$data = json_decode($results, true);
```

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

[](#installation)

You can install the package via composer:

```
composer require alnutile/fixtures
```

Then (since I can not figure out a way around this) add it to your composer.json file:

```
    "autoload": {
        "psr-4": {
            "App\\": "app/",
            //some stuff is here
        },
        "files": [
            "vendor/alnutile/fixtures/src/helpers.php"
        ]
    },
```

The run:

```
composer dump
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

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

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Alfred Nutile](https://github.com/alnutile)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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 ~17 days

Total

3

Last Release

1167d ago

### Community

Maintainers

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

---

Top Contributors

[![alnutile](https://avatars.githubusercontent.com/u/365385?v=4)](https://github.com/alnutile "alnutile (11 commits)")

---

Tags

laravelfixturesalnutile

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/alnutile-fixtures/health.svg)

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-visit

Quickly visit any route of your Laravel app

15614.6k](/packages/spatie-laravel-visit)[christophrumpel/missing-livewire-assertions

This package adds missing livewire test assertions.

149336.0k9](/packages/christophrumpel-missing-livewire-assertions)[michiruf/laravel-http-automock

Automatically mock http requests when testing

161.0k](/packages/michiruf-laravel-http-automock)

PHPackages © 2026

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