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

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

weew/http-server
================

Simple wrapper for the php's built in http server.

v1.1.1(9y ago)12302MITPHP

Since Jul 21Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (13)Used By (2)

HTTP server
===========

[](#http-server)

[![Build Status](https://camo.githubusercontent.com/8e10a026d0e0ef974964bcf2a339c983a62d9bfbfec8ad38b0e7685615dde145/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776565772f687474702d7365727665722e737667)](https://travis-ci.org/weew/http-server)[![Code Quality](https://camo.githubusercontent.com/e96a974768f1967605b0e584efad53d07f54ec05434610df3c632c9bef459f7a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f776565772f687474702d7365727665722e737667)](https://scrutinizer-ci.com/g/weew/http-server)[![Test Coverage](https://camo.githubusercontent.com/6cca4b41fa253fa4c608cde0631675c2157e8861ef4472dcf108ae3cd8240bc5/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f776565772f687474702d7365727665722e737667)](https://coveralls.io/github/weew/http-server)[![Dependencies](https://camo.githubusercontent.com/e93d5c07d950cee59cd95bbe1256dc89ac4319e76ecb753f0ca7d7ac02bb1432/68747470733a2f2f696d672e736869656c64732e696f2f76657273696f6e6579652f642f7068702f776565773a687474702d7365727665722e737667)](https://versioneye.com/php/weew:http-server)[![Version](https://camo.githubusercontent.com/1cc9f8c3862f8d53c74b6199b397cd35f576ed2d73debf63331b9b56cbb01e10/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776565772f687474702d7365727665722e737667)](https://packagist.org/packages/weew/http-server)[![Licence](https://camo.githubusercontent.com/7fd4ecc57ef3c13f470e54252e6e881f3c5a4a21b18a15c0d2b5000272cc67d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776565772f687474702d7365727665722e737667)](https://packagist.org/packages/weew/http-server)

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

[](#table-of-contents)

- [Installation](#installation)
- [Basic usage](#basic-usage)
- [Advanced options](#advanced-options)
- [Related projects](#related-projects)

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

[](#installation)

`composer require weew/http-server`

Basic usage
-----------

[](#basic-usage)

To start the server, simply pass in a hostname, desired port and the root directory for your server.

```
// all files within the given directory will be available
// at http://localhost:9999, if you've passed a file
// name instead of a directory the server will always serve this
// file, no matter how the URI looks like
$server = new HttpServer('localhost', 9999, __DIR__);

// incoming requests will be logged to this file
$server->setLogFile('/tmp/log');

$server->start();
$server->isRunning(); // true
$server->stop();
```

Advanced options
----------------

[](#advanced-options)

You can tell the server to block current process until the server has started by passing in a `$waitForProcess` value. You can also disable the server output completely.

```
// starting the server will wait for the server to start
// for a maximum of 2 seconds, then it will throw an exception
// saying that the process took too long to start
// the default value is 5.0 seconds
$waitForProcess = 2.0;
// enables log messages like
// [HTTP SERVER] Wed, 12 Aug 2015 19:49:25 +0200 - HTTP server started on localhost:9999 with PID 99412
// [HTTP SERVER] Wed, 12 Aug 2015 19:56:18 +0200 - Server is already running at localhost:9999 with PID 99535
// [HTTP SERVER] Wed, 12 Aug 2015 19:49:25 +0200 - Killing process with PID 99412
$enableOutput = true;

$server = new HttpServer('localhost', 9999, __DIR__, $waitForProcess, $enableOutput);
$server->start();
```

Related Projects
----------------

[](#related-projects)

- [HTTP Blueprint](https://github.com/weew/http-blueprint): spin up a server, serve some content, shutdown the server.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~84 days

Total

12

Last Release

3585d ago

Major Versions

v0.0.9 → v1.0.02015-11-16

### Community

Maintainers

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

---

Top Contributors

[![f3ath](https://avatars.githubusercontent.com/u/831399?v=4)](https://github.com/f3ath "f3ath (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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