PHPackages                             laravelfr/api-testing - 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. laravelfr/api-testing

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

laravelfr/api-testing
=====================

A package which provide all you need for testing apis!

1.0.0(8y ago)11.9kGPL-3.0PHPPHP &gt;=5.5

Since Jul 31Pushed 8y ago1 watchersCompare

[ Source](https://github.com/laravelfr/api-testing)[ Packagist](https://packagist.org/packages/laravelfr/api-testing)[ RSS](/packages/laravelfr-api-testing/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Laravel Api Testing
===================

[](#laravel-api-testing)

#### *By the LaravelFr Team*

[](#by-the-laravelfr-team)

This package provide you some methods to fully test your Laravel API.

The LaravelFr team is a group of french friends who decide to put in common some useful methods for testing API. Whoever you are, feel free to contribute to this package or join the organisation to add yours !

[![Travis Build](https://camo.githubusercontent.com/39f4b9f0a9e6d86647d5b32ebc357b2c3e9be65becbc043e6af5bffa39c72d06/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c66722f6170692d74657374696e672f6d61737465722e737667)](https://travis-ci.org/laravelfr/api-testing?branch=master)[![StyleCI](https://camo.githubusercontent.com/6a2674e33e49b75076b13fb60590cc6dc24efca6c3935d1301352307d7dfa0f7/68747470733a2f2f7374796c6563692e696f2f7265706f732f37343530313937362f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/74501976)[![Code Coverage](https://camo.githubusercontent.com/b75eff63aa36e3953ba5abe261898b5602371e44322f84c3cbaa6b964892ebc5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c66722f6170692d74657374696e672e737667)](https://scrutinizer-ci.com/g/laravelfr/api-testing/?branch=master)[![Code Quality](https://camo.githubusercontent.com/e353c44819165aad94d991aa61e261b1837ba2639f0f863937c79ec6fb817c58/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c66722f6170692d74657374696e672e737667)](https://scrutinizer-ci.com/g/laravelfr/api-testing/?branch=master)

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

[](#installation)

```
composer require laravelfr/api-testing
```

Usage
-----

[](#usage)

Once Laravel API Testing is installed, you can extend or implement the classes and traits in this package. There are no service providers to register.

It works both with old testing way (Laravel &lt;5.4 and &gt;5.4 with BrowserKit) and with new testing way (with response object).

- Old way: Just use `\LaravelFr\ApiTesting\AssertArrays` and `\LaravelFr\ApiTesting\AssertJsonResponse` traits, and use directly the methods from traits.
- New way: for `AssertJsonResponse`, you can add the trait, and directly use the methods on response object.

See Tests for some examples.

Available methods:
------------------

[](#available-methods)

On this response example :

```
{
   "foo": 134,
   "foobar": {
       "foobar_foo": "foo",
       "foobar_bar": 212
   },
   "bars": [
       {
           "bar": true,
           "foo": 134.212
       },
       {
           "bar": false,
           "foo": 134.212
       },
       {
           "bar": false,
           "foo": 134.212
       }
   ],
   "baz": [
       {
           "foo": "Laravel",
           "bar": {
               "foo": true,
               "bar": 134
           }
       },
       {
           "foo": "France",
           "bar": {
               "foo": false,
               "bar": 212
           }
       }
   ]
}

```

- `assertJsonStructureEquals`: check if it respects the **exact** structure pattern.

```
$response->assertJsonStructureEquals([
    'foo',
    'baz' => ['*' => ['bar' => ['*'], 'foo']],
    'bars' => ['*' => ['bar', 'foo']],
    'foobar' => ['foobar_foo', 'foobar_bar'],
]);
```

- `seeJsonTypedStructure`: check if it respects a typed pattern.

```
$response->seeJsonTypedStructure([
    'foo' => 'integer',
    'baz' => ['*' => ['bar' => 'array', 'foo' => 'string']],
    'bars' => ['*' => ['bar' => 'boolean', 'foo' => 'float']],
    'foobar' => ['foobar_foo' => 'string', 'foobar_bar' => 'int'],
]);
```

- `seeJsonTypedStructure`: retrieve a part of response in array format.

```
$response->jsonResponse('foobar.foobar_bar')); // 212
```

Credits
-------

[](#credits)

- Maintenance: Mathieu TUDISCO ,
- Methods:
    - [@mathieutu](https://github.com/mathieutu)
    - [@welcoMattic](https://github.com/welcomattic)

Please feel free to make PRs and add yours!

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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

Unknown

Total

1

Last Release

3210d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11351322?v=4)[Mathieu TUDISCO](/maintainers/mathieutu)[@mathieutu](https://github.com/mathieutu)

---

Top Contributors

[![mathieutu](https://avatars.githubusercontent.com/u/11351322?v=4)](https://github.com/mathieutu "mathieutu (18 commits)")[![welcoMattic](https://avatars.githubusercontent.com/u/773875?v=4)](https://github.com/welcoMattic "welcoMattic (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravelfr-api-testing/health.svg)

```
[![Health](https://phpackages.com/badges/laravelfr-api-testing/health.svg)](https://phpackages.com/packages/laravelfr-api-testing)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

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

Testing helpers for your OpenAPI spec

3021.4M1](/packages/hotmeteor-spectator)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8017.0M43](/packages/orchestra-workbench)[botble/git-commit-checker

Check coding standard &amp; code syntax with Git pre-commit hook.

47186.4k1](/packages/botble-git-commit-checker)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[spurwork/spectator

Testing helpers for your OpenAPI spec

3021.5k](/packages/spurwork-spectator)

PHPackages © 2026

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