PHPackages                             missionx-co/laravel-better-http-fake - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. missionx-co/laravel-better-http-fake

ActiveLibrary[HTTP &amp; Networking](/categories/http)

missionx-co/laravel-better-http-fake
====================================

A package that provides improved helpers for faking Laravel HTTP client requests.

0.0.4(6mo ago)015MITPHPPHP ^8.2

Since May 3Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/missionx-co/laravel-better-http-fake)[ Packagist](https://packagist.org/packages/missionx-co/laravel-better-http-fake)[ Docs](https://github.com/missionx/laravel-better-http-fake)[ RSS](/packages/missionx-co-laravel-better-http-fake/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (4)Used By (0)

Laravel Better Http Fake
========================

[](#laravel-better-http-fake)

A package that provides improved helpers for faking Laravel HTTP client requests.

---

Current Laravel HTTP Fake Workflow
----------------------------------

[](#current-laravel-http-fake-workflow)

### Example Service Class

[](#example-service-class)

```
class Service {
    public function createInstance($data) {
        return $this->client()->post('/instances', $data)->json();
    }

    public function client(): PendingRequest {
        return Http::baseUrl('https://service.com')
            ->withToken(config('services.service.api_key'));
    }
}
```

### Testing Steps (Without This Package)

[](#testing-steps-without-this-package)

#### 1. Fake the response:

[](#1-fake-the-response)

```
Http::fake([
    'https://service.com/instances' => Http::response(['key' => 'value'], 204)
]);
```

#### 2. Trigger the request

[](#2-trigger-the-request)

```
(new Service)->createInstance(['bodyKey' => 'bodyValue']);
```

#### 3. Manually verify the request:

[](#3-manually-verify-the-request)

```
Http::assertSent(function($request) {
    return $request->url() == "https://service.com/instances" &&
           $request->method() == 'POST' &&
           $request->data() == ['bodyKey' => 'bodyValue'];
});
```

With Laravel Better Http Fake
-----------------------------

[](#with-laravel-better-http-fake)

### Basic Usage

[](#basic-usage)

```
(new Service)->client()
    ->shouldMakePostRequestTo('instances')
    ->withData(['bodyKey' => 'bodyValue'])  // Verify payload
    ->andRespondWith(['key' => 'value']);   // Fake response

(new Service)->createInstance($body);  // Execute
```

### Key Features

[](#key-features)

#### 1. Skip Request Verification

[](#1-skip-request-verification)

```
->doNotAssertSent();  // Only fake the response, skip checks
```

#### 2. Multiple Responses (Sequence)

[](#2-multiple-responses-sequence)

```
->andRespondWithSequence(
    Http::sequence([
        Http::response([]),  // First response
        Http::response([]),  // Second response
    ])
);
```

#### 3. Headers Validation

[](#3-headers-validation)

```
->withHeaders(['Header-Key' => 'Header-Value']);  // Verify headers
```

#### 4. File Upload Verification

[](#4-file-upload-verification)

```
->withFile('photo', 'profile.jpg');  // Verify file uploads
```

#### 5. Test Multiple HTTP Verbs

[](#5-test-multiple-http-verbs)

Supports all common HTTP methods with dedicated methods:

```
// GET Request
->shouldMakeGetRequestTo('users/1')
// PUT Request
->shouldMakePutRequestTo('users/1')
// PATCH Request
->shouldMakePatchRequestTo('profile')
// DELETE Request
->shouldMakeDeleteRequestTo('posts/123')
```

### Why Use This Package?

[](#why-use-this-package)

- **Simpler tests**: Combine faking + assertions in one chain
- **Clearer syntax**: Reads like plain English instructions
- **Fewer mistakes**: Automatic request validation by default
- **Time saver**: No more separate setup/verification steps

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance67

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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

Total

3

Last Release

192d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aeb75f35979097845cce704062910a6a8c85bc0a7b49b081df7350a4f20023fc?d=identicon)[manssour.mohammed](/maintainers/manssour.mohammed)

---

Top Contributors

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

---

Tags

laravelMissionXlaravel-better-http-fake

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/missionx-co-laravel-better-http-fake/health.svg)

```
[![Health](https://phpackages.com/badges/missionx-co-laravel-better-http-fake/health.svg)](https://phpackages.com/packages/missionx-co-laravel-better-http-fake)
```

###  Alternatives

[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[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)[pdphilip/cf-request

Cloudflare Laravel Request

2725.6k1](/packages/pdphilip-cf-request)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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