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

ActiveLibrary

weew/http-blueprint
===================

Very basic blueprint server for API prototyping.

v2.1.0(9y ago)0501MITPHP

Since Jul 21Pushed 9y ago1 watchersCompare

[ Source](https://github.com/weew/http-blueprint)[ Packagist](https://packagist.org/packages/weew/http-blueprint)[ RSS](/packages/weew-http-blueprint/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (17)Used By (1)

HTTP blueprint server
=====================

[](#http-blueprint-server)

[![Build Status](https://camo.githubusercontent.com/71a0b73215184b556d1f6c49cbe0415d18ab971037619d5e87f4fcf30fcc9f87/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776565772f687474702d626c75657072696e742e737667)](https://travis-ci.org/weew/http-blueprint)[![Code Quality](https://camo.githubusercontent.com/3a1e8bd25f21d91f2b6470a7bcf296b9401efcc063578cf8129ae081f4fb7ef3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f776565772f687474702d626c75657072696e742e737667)](https://scrutinizer-ci.com/g/weew/http-blueprint)[![Test Coverage](https://camo.githubusercontent.com/1995bcf4451434604d81c0bd0b62f620d98e0af823071f4fc12c787b2a3f1e9f/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f776565772f687474702d626c75657072696e742e737667)](https://coveralls.io/github/weew/http-blueprint)[![Dependencies](https://camo.githubusercontent.com/2dd64e5487c057f8328f66f04b1e4c6cf9790bdb5154cd97f72e365442fd66fe/68747470733a2f2f696d672e736869656c64732e696f2f76657273696f6e6579652f642f7068702f776565773a687474702d626c75657072696e742e737667)](https://versioneye.com/php/weew:http-blueprint)[![Version](https://camo.githubusercontent.com/a0079118ff5d54d6e79889a285615d830c5a895c408c2ed9bae3ad796a904564/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776565772f687474702d626c75657072696e742e737667)](https://packagist.org/packages/weew/http-blueprint)[![Licence](https://camo.githubusercontent.com/b00c70577c67b86f06f407e24b6d8024a88d6712d69bb64747f1eae924bf688b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776565772f687474702d626c75657072696e742e737667)](https://packagist.org/packages/weew/http-blueprint)

Table of contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Introduction](#introduction)
- [Creating a blueprint](#creating-a-blueprint)
- [Starting and stopping the server](#starting-and-stopping-the-server)
- [Related projects](#related-projects)

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

[](#installation)

`composer require weew/http-blueprint`

Introduction
------------

[](#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](https://github.com/weew/http) and the [http client](https://github.com/weew/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
--------------------

[](#creating-a-blueprint)

Create a file that will be used as your blueprint. Register your routes in there. Let the proxy to the rest.

```
// file: blueprint.php

// create a proxy
$proxy = new BlueprintProxy();

// register all of your routes
$proxy->getRouter()
    ->get('/', 'hello world')
    ->get('about', new HttpResponse(HttpStatusCode::OK, 'foo'))
    ->post('post', function() {
        return 'hello world';
    })
    ->put('users/{id}', function(IHttpRequest $request, array $parameters) {
        return new HttpResponse(HttpStatusCode::OK, $parameters['id']);
    });

// send a response
$proxy->sendResponse();
```

Starting and stopping the server
--------------------------------

[](#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.

```
$server = new BlueprintServer('localhost', 9000, '/path/to/blueprint.php');
$server->start();
```

When you're done, simply stop the server.

```
$server->stop();
```

Related projects
----------------

[](#related-projects)

- [HTTP Layer](https://github.com/weew/http): offers response and request objects, handles cookies, headers and much more.
- [HTTP Server](https://github.com/weew/http-server): allows you to start an http server in a directory of your choice.
- [HTTP Client](https://github.com/weew/http-client): allows you to send HttpRequest and to receive HttpResponse objects.
- [Router](https://github.com/weew/router): allows you to create complex routes and map them to a response.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~83 days

Total

16

Last Release

3573d ago

Major Versions

v0.1.3 → v1.0.02015-11-16

v1.0.0 → v2.0.02016-01-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/10b2b854b5829dd13a15967c000ed2119b5faef67aca24d94c653c8ac550d85e?d=identicon)[weew](/maintainers/weew)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/weew-http-blueprint/health.svg)

```
[![Health](https://phpackages.com/badges/weew-http-blueprint/health.svg)](https://phpackages.com/packages/weew-http-blueprint)
```

PHPackages © 2026

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