PHPackages                             ronappleton/static-web - 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. ronappleton/static-web

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

ronappleton/static-web
======================

Testing PHP Server

v1.0.1(5y ago)07MITPHPPHP &gt;=5.4

Since Mar 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ronappleton/staticweb)[ Packagist](https://packagist.org/packages/ronappleton/static-web)[ RSS](/packages/ronappleton-static-web/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

Static Web
==========

[](#static-web)

Overview
--------

[](#overview)

Static Web is a real simple library for simulating webserver responses. It was created for the purpose of testing the middleware of a guzzle client.

It was created for using in unit tests.

Its usage is simple, it's operation is simple, because of this any version of php above 5.4 can be used.

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

[](#installation)

```
composer require ronappleton/static-web

```

Usage
-----

[](#usage)

This usage example covers unit tests only as that it was made for, however it is not limited to that usage, but please only use it for local testing environments, it's single threaded and thus will block and is in no way useable in a production environment.

Add 2 use statements to the top of you test class

```
use RonAppleton\StaticWeb\Server;
use RonAppleton\StaticWeb\Router;
```

In the constructor of your test class or set up method, create a new router instance to use a global router using `$this->router->clearRoutes()`at the start of your test methods.

A thing to note is that the routes are reloaded before every request is processed

```
Server::run($port, $domain, $docRoot, $routerRoute);
$this->router = new Router();
```

The server port is an int with the remaining fields strings.

To add routes, use the following syntax

```
$this->router->get($route, $content, $options = []);
```

Where `route` is a string, `content` is a string, either a normal string or a php script to be evaluated and `$options`is an array of optional details for your requests like headers, or response details.

All standard route methods are available

- GET
- HEAD
- POST
- PUT
- DELETE
- CONNECT
- OPTIONS
- TRACE
- PATCH

However, you should continually bear in mind that it is up to your to provide the responses.

In your tear down method simply call `Server::stop();` to kill the server.

Whilst the server is limited in its usage, remember that you can pass the contents of a php file to be evaulated before returning the response, this means that all your super globals etcetera are available for your usage so if you need query parameters, get them within your evaluated script.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

1878d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e2afdd94a6f21a4ec2c5df569b80c1d47d6f5d0428f866f55c4bc117856b58b?d=identicon)[Ron Appleton](/maintainers/Ron%20Appleton)

---

Top Contributors

[![ronappleton](https://avatars.githubusercontent.com/u/3792420?v=4)](https://github.com/ronappleton "ronappleton (7 commits)")

### Embed Badge

![Health badge](/badges/ronappleton-static-web/health.svg)

```
[![Health](https://phpackages.com/badges/ronappleton-static-web/health.svg)](https://phpackages.com/packages/ronappleton-static-web)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

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