Download the PHP package weew/http-blueprint without Composer
On this page you can find all versions of the php package weew/http-blueprint. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download weew/http-blueprint
More information about weew/http-blueprint
Files in weew/http-blueprint
Package http-blueprint
Short Description Very basic blueprint server for API prototyping.
License MIT
Informations about the package http-blueprint
HTTP blueprint server
Table of contents
- Installation
- Introduction
- Creating a blueprint
- Starting and stopping the server
- Related projects
Installation
composer require weew/http-blueprint
Introduction
This little package allows you to easily spin up a server, maybe during your unit tests. It consists of two parts, the server and the proxy. The server is responsible for starting and stopping of, big surprise, the http server. The proxy is basically responsible for grabbing all of the registered routes, figuring out which one should be called and returning an http response.
This package was mainly built for testing of the http layer and the http client where I could not simply mock the endpoints, but had instead to actually test the whole http communication and the resulting requests and responses. But at the end I think this is a really useful package and might be used elsewhere as well.
Creating a blueprint
Create a file that will be used as your blueprint. Register your routes in there. Let the proxy to the rest.
Starting and stopping the server
It is very easy. Just pass in the hostname, your desired port, and the path to the blueprint file you've created.
When you're done, simply stop the server.
Related projects
- HTTP Layer: offers response and request objects, handles cookies, headers and much more.
- HTTP Server: allows you to start an http server in a directory of your choice.
- HTTP Client: allows you to send HttpRequest and to receive HttpResponse objects.
- Router: allows you to create complex routes and map them to a response.