Download the PHP package pinkcrab/http without Composer
On this page you can find all versions of the php package pinkcrab/http. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pinkcrab/http
More information about pinkcrab/http
Files in pinkcrab/http
Package http
Short Description Wrapper around Nyholm\Psr7 library with a few helper methods and a basic emitter. For use in WordPress during ajax calls.
License MIT
Homepage https://pinkcrab.co.uk
Informations about the package http
HTTP
Wrapper around Nyholm\Psr7 library with a few helper methods and a basic emitter. For use in WordPress during ajax calls.
Why?
Throughout a few of our modules we need to handle HTTP requests and responses. The WPHTTP* 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
Creates a WP_HTTP_Response
As both have the same signatures, you can interchange at will. Obviously the PS7 Response has more functionality to fine tune the response.
Creates a PS7 Response
Creates a PS7 Request
Get ServerRequest fromGlobals
Returns a populated instance of ServerRequestInterface.
Create Stream
The PSR7 HTTP objects work with streams for the body, you can wrap all scalars values which can cast to JSON in a stream.
The
has been marked as deprecated since 0.2.3. use
in its place.
License
MIT License
http://www.opensource.org/licenses/mit-license.html
Change Log
- 1.0.0 - Removed HTTP::create_stream_with_json()
- 0.2.6 - Readme changes
- 0.2.5 - Removed object type hint for param in emit_response
- 0.2.4 - Typo on scalar (all typed as scala)
- 0.2.3 - Added in
HTTP_Helper
class, patchedServerRequest
fromGloabls
to include the raw $_POST in its body. - 0.2.2 - Added the helper for wrapping data as json in Stream
- 0.2.1 - Removed die() from end of Emit calls and just returned back void. Die to happen at other end
- 0.2.0 - Moved from Guzzle being injected in constructor to using custom HTTP (pink crab). Plug move to composer format.