PHPackages                             pinkcrab/http - 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. pinkcrab/http

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

pinkcrab/http
=============

Wrapper around Nyholm\\Psr7 library with a few helper methods and a basic emitter. For use in WordPress during ajax calls.

1.2.0(3w ago)03.0k[1 PRs](https://github.com/Pink-Crab/HTTP/pulls)2MITPHPPHP &gt;=8.0.0CI failing

Since Jan 19Pushed 1y agoCompare

[ Source](https://github.com/Pink-Crab/HTTP)[ Packagist](https://packagist.org/packages/pinkcrab/http)[ Docs](https://pinkcrab.co.uk)[ RSS](/packages/pinkcrab-http/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (31)Versions (15)Used By (2)

HTTP
====

[](#http)

Wrapper around Nyholm\\Psr7 library with a few helper methods and a basic emitter. For use in WordPress during ajax calls.

[![Latest Stable Version](https://camo.githubusercontent.com/89fd3e1dbe23ff8e445d8475850787ed211efa1a885ee423cf2415dec65448dc/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f687474702f76)](https://packagist.org/packages/pinkcrab/http)[![Total Downloads](https://camo.githubusercontent.com/ffbe2c35bb95728f07a51cadff6ad2864f72cbd863e0afa104f7341716ada621/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f687474702f646f776e6c6f616473)](https://packagist.org/packages/pinkcrab/http)[![License](https://camo.githubusercontent.com/f9217fd7c28219524a8bebbdf769ef973b7cf0ddfa35c1387dc180c667a06a77/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f687474702f6c6963656e7365)](https://packagist.org/packages/pinkcrab/http)[![PHP Version Require](https://camo.githubusercontent.com/5afc4b477b112f49603291ed1caff64f01c99696a78e8951ced4ed13aec3b32e/68747470733a2f2f706f7365722e707567782e6f72672f70696e6b637261622f687474702f726571756972652f706870)](https://packagist.org/packages/pinkcrab/http)[![GitHub contributors](https://camo.githubusercontent.com/eead82b2375fff602668522ef3b0a3d4fed39d3a213ab65abf06bf58f5237764/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f485454503f6c6162656c3d436f6e7472696275746f7273)](https://camo.githubusercontent.com/eead82b2375fff602668522ef3b0a3d4fed39d3a213ab65abf06bf58f5237764/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f50696e6b2d437261622f485454503f6c6162656c3d436f6e7472696275746f7273)[![GitHub issues](https://camo.githubusercontent.com/6bbf9481e8c5d8209f54fe8cf7f80a4854b7f72ce8d90347c356cc614fd95150/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f48545450)](https://camo.githubusercontent.com/6bbf9481e8c5d8209f54fe8cf7f80a4854b7f72ce8d90347c356cc614fd95150/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f50696e6b2d437261622f48545450)

[![WordPress 6.7 Test Suite [PHP7.4-8.4]](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_7.yaml/badge.svg?branch=master)](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_7.yaml)[![WordPress 6.6 Test Suite [PHP7.4-8.4]](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_6.yaml/badge.svg?branch=master)](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_6.yaml)[![WordPress 6.5 Test Suite [PHP7.4-8.3]](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_5.yaml/badge.svg?branch=master)](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_5.yaml)[![WordPress 6.4 Test Suite [PHP7.4-8.3]](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_4.yaml/badge.svg?branch=master)](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_4.yaml)[![WordPress 6.3 Test Suite [PHP7.4-8.3]](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_3.yaml/badge.svg?branch=master)](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_3.yaml)[![WordPress 6.2 Test Suite [PHP7.4-8.3]](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_2.yaml/badge.svg?branch=master)](https://github.com/Pink-Crab/HTTP/actions/workflows/WP_6_2.yaml)

[![codecov](https://camo.githubusercontent.com/4eafa144c52933ced91c1fcf42381f81a1fbe2497d96cf591f8cd76b3dbeaba8/68747470733a2f2f636f6465636f762e696f2f67682f50696e6b2d437261622f485454502f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d5a5032444e4256334d54)](https://codecov.io/gh/Pink-Crab/HTTP)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4f691c3ec852d9f779cef374eaa1fd968db63366f19ac3bed2a5e25970d75690/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f50696e6b2d437261622f485454502f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Pink-Crab/HTTP/?branch=master)[![Maintainability](https://camo.githubusercontent.com/fb43570df59b577a5436994d5f783bf2dca088cbbdaa5ee054707dd70457ed4c/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f33663235383061633734336532656335343534322f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/Pink-Crab/HTTP/maintainability)

Why?
----

[](#why)

Throughout a few of our modules we need to handle HTTP requests and responses. The WP\_HTTP\_\* classes are great, but PS7 compliant libraries have a lot more to offer.

So this small module acts a wrapper for the Nyholm\\Psr7 and Nyholm\\Psr7Server libraries and gives a few helper methods. You can easily create and emit either Responses that extend **WP\_HTTP\_RESPONSE** or implements **ResponseInterface**

Examples
--------

[](#examples)

### Creates a WP\_HTTP\_Response

[](#creates-a-wp_http_response)

```
