PHPackages                             php-http/mock-client - 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. php-http/mock-client

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

php-http/mock-client
====================

Mock HTTP client

1.6.1(1y ago)719.7M—2.1%17[1 PRs](https://github.com/php-http/mock-client/pulls)20MITPHPPHP ^7.1 || ^8.0

Since Dec 29Pushed 1y ago6 watchersCompare

[ Source](https://github.com/php-http/mock-client)[ Packagist](https://packagist.org/packages/php-http/mock-client)[ Docs](http://httplug.io)[ RSS](/packages/php-http-mock-client/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (22)Used By (20)

Mock Client
===========

[](#mock-client)

[![Latest Version](https://camo.githubusercontent.com/7d894a3aa21510c467eee935363aae92c6067c883d23876571ea2a8c9b64246c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7068702d687474702f6d6f636b2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-http/mock-client/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://github.com/php-http/mock-client/actions/workflows/tests.yml/badge.svg)](https://github.com/php-http/mock-client/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/36d8a56db4015897584515e25a6eeca89b1511f7689183608cb7b08155291f86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d687474702f6d6f636b2d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-http/mock-client)

**Mock HTTP client**

Install
-------

[](#install)

Via Composer

```
composer require --dev php-http/mock-client
```

Usage
-----

[](#usage)

This client does not actually send requests to any server.

Instead it stores the request and returns a pre-set response or throws an exception. This client is useful for unit testing code that depends on a HTTPlug client to send requests and receive responses.

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

[](#documentation)

Please see the [mock client](http://docs.php-http.org/en/latest/clients/mock-client.html) section in the [official documentation](http://docs.php-http.org).

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see our [contributing guide](http://docs.php-http.org/en/latest/development/contributing.html).

Security
--------

[](#security)

If you discover any security related issues, please contact us at .

Credits
-------

[](#credits)

Thanks to [David de Boer](https://github.com/ddeboer) for implementing the mock client.

License
-------

[](#license)

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

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity60

Solid adoption and visibility

Community50

Growing community involvement

Maturity77

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~137 days

Total

21

Last Release

565d ago

Major Versions

v0.3.3 → 1.0.02017-03-10

PHP version history (5 changes)v0.1.0PHP &gt;=5.4

0.3.1PHP ^5.5|^7.0

0.3.2PHP ^5.5 || ^7.0

1.4.0PHP ^7.1

1.4.1PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e4e105cea62b616d4cb376b08a849b6a428f646998537de150d16a8eb537b90?d=identicon)[mark.sagikazar](/maintainers/mark.sagikazar)

![](https://avatars.githubusercontent.com/u/76576?v=4)[David Buchmann](/maintainers/dbu)[@dbu](https://github.com/dbu)

![](https://www.gravatar.com/avatar/3fb6e13a139230893f783118651540d3d057979fd726fefd135b1b397873010e?d=identicon)[php-http](/maintainers/php-http)

---

Top Contributors

[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (44 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (12 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (7 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (7 commits)")[![ddeboer](https://avatars.githubusercontent.com/u/89267?v=4)](https://github.com/ddeboer "ddeboer (5 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (5 commits)")[![KDederichs](https://avatars.githubusercontent.com/u/24696606?v=4)](https://github.com/KDederichs "KDederichs (3 commits)")[![soullivaneuh](https://avatars.githubusercontent.com/u/1698357?v=4)](https://github.com/soullivaneuh "soullivaneuh (2 commits)")[![adamquaile](https://avatars.githubusercontent.com/u/69929?v=4)](https://github.com/adamquaile "adamquaile (1 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (1 commits)")[![adelplace](https://avatars.githubusercontent.com/u/18348913?v=4)](https://github.com/adelplace "adelplace (1 commits)")[![danalloway](https://avatars.githubusercontent.com/u/2057295?v=4)](https://github.com/danalloway "danalloway (1 commits)")[![JoepdeJong](https://avatars.githubusercontent.com/u/7187634?v=4)](https://github.com/JoepdeJong "JoepdeJong (1 commits)")[![krichprollsch](https://avatars.githubusercontent.com/u/562696?v=4)](https://github.com/krichprollsch "krichprollsch (1 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (1 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (1 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (1 commits)")

---

Tags

httpclientpsr7mock

### Embed Badge

![Health badge](/badges/php-http-mock-client/health.svg)

```
[![Health](https://phpackages.com/badges/php-http-mock-client/health.svg)](https://phpackages.com/packages/php-http-mock-client)
```

###  Alternatives

[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[mcustiel/phiremock

A mocker for HTTP and REST services. Full bundle.

151947.1k5](/packages/mcustiel-phiremock)[mozex/anthropic-php

Anthropic PHP is a supercharged community-maintained PHP API client that allows you to interact with Anthropic API.

46365.1k13](/packages/mozex-anthropic-php)

PHPackages © 2026

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