PHPackages                             neur0toxine/pock - 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. neur0toxine/pock

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

neur0toxine/pock
================

PSR-18 compatible HTTP mock library

v0.13.0(1mo ago)446.5k—3.8%27MITPHPPHP &gt;=7.2.0CI passing

Since May 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Neur0toxine/pock)[ Packagist](https://packagist.org/packages/neur0toxine/pock)[ Docs](https://github.com/Neur0toxine/pock)[ RSS](/packages/neur0toxine-pock/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (33)Versions (19)Used By (7)

[![Build Status](https://camo.githubusercontent.com/ddcf7c90df5c5ebc40462840aaf07d6f0f4733908eb57a2be25489f89601ca3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4e65757230746f78696e652f706f636b2f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/ddcf7c90df5c5ebc40462840aaf07d6f0f4733908eb57a2be25489f89601ca3c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4e65757230746f78696e652f706f636b2f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)[![Coverage](https://camo.githubusercontent.com/5449f4780241ded2b852ac1af0dcd26f4e447dc21e1fa40a2d30496cd62df620/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f4e65757230746f78696e652f706f636b2f6d61737465722e7376673f6c6f676f3d636f6465636f76266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://codecov.io/gh/Neur0toxine/pock)[![Latest stable](https://camo.githubusercontent.com/64e51597120a4d8106e38f28dca5078e88e8df8faed3f537524fbe20ee551ef1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65757230746f78696e652f706f636b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/neur0toxine/pock)[![PHP from Packagist](https://camo.githubusercontent.com/e77365e2e2688f17abbdcacfcb737ac0cdc599ed4ec1d841e33550154f77905e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e65757230746f78696e652f706f636b2e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://packagist.org/packages/neur0toxine/pock)[![License](https://camo.githubusercontent.com/97da4f11df019933cee3f06b49bb9ca8a44278b61ea654da8b067a1e6c1959f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4e65757230746f78696e652f706f636b3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/97da4f11df019933cee3f06b49bb9ca8a44278b61ea654da8b067a1e6c1959f2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f4e65757230746f78696e652f706f636b3f7374796c653d666c61742d737175617265)

pock
====

[](#pock)

Easy-to-use HTTP mocking for tests, compatible with PSR-18, HTTPlug, and Symfony HTTP Client.

The project is still in its early development stage. Its API can change over time, although breaking changes are avoided where possible.

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

[](#installation)

```
composer require --dev neur0toxine/pock
```

Quick start
-----------

[](#quick-start)

```
use Nyholm\Psr7\Factory\Psr17Factory;
use Pock\Enum\RequestMethod;
use Pock\PockBuilder;

$pock = new PockBuilder();
$pock->matchMethod(RequestMethod::GET)
    ->matchUri('https://api.example.com/users/42')
    ->reply(200)
    ->withHeader('Content-Type', 'application/json')
    ->withJson(['id' => 42, 'name' => 'Jane']);

$factory = new Psr17Factory();
$request = $factory->createRequest('GET', 'https://api.example.com/users/42');
$response = $pock->getClient()->sendRequest($request);

assert(200 === $response->getStatusCode());
assert(['id' => 42, 'name' => 'Jane'] === json_decode((string) $response->getBody(), true));
```

Pass `$pock->getClient()` to code that expects a PSR-18 or HTTPlug client. Use `$pock->getSymfonyClient()` for code built on Symfony HTTP Client.

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

[](#documentation)

Read the [usage guides](https://neur0toxine.github.io/pock/guide/) for installation, compatibility, request matching, JSON, XML, response behavior, mock lifecycle, client integrations, and extension points.

The generated [API reference](https://neur0toxine.github.io/pock/) documents every public class and method. The main entry points are [PockBuilder](https://neur0toxine.github.io/pock/classes/Pock-PockBuilder.html) and [PockResponseBuilder](https://neur0toxine.github.io/pock/classes/Pock-PockResponseBuilder.html).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity33

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity46

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

Recently: every ~391 days

Total

17

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e421901d9ce2555337064441185824281408c5cdcd1224ed74e824995c3afd0?d=identicon)[Neur0toxine](/maintainers/Neur0toxine)

---

Top Contributors

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

---

Tags

apidtohttpjsonmocknetworkpockpsr-17psr-18psr-7serializerhttppsr-7symfonypsr-18mockphp-http

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/neur0toxine-pock/health.svg)

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

###  Alternatives

[guzzlehttp/guzzle

Guzzle is a PHP HTTP client library

23.5k1.1B37.7k](/packages/guzzlehttp-guzzle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k6.0M778](/packages/sylius-sylius)[bref/bref

Bref is a framework to write and deploy serverless PHP applications on AWS Lambda.

3.4k11.0M75](/packages/bref-bref)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.9k](/packages/cakephp-cakephp)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)

PHPackages © 2026

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