PHPackages                             yosymfony/httpserver - 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. yosymfony/httpserver

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

yosymfony/httpserver
====================

A simple HTTP server

v1.3.0(9y ago)1940.1k↓50%3[1 PRs](https://github.com/yosymfony/HttpServer/pulls)1MITPHPPHP &gt;=5.5.5

Since Sep 22Pushed 9y ago2 watchersCompare

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

READMEChangelog (5)Dependencies (3)Versions (6)Used By (1)

A simple HTTP server for PHP
----------------------------

[](#a-simple-http-server-for-php)

HttpServer is a simple HTTP server powerd [REACT](http://reactphp.org/).

[![Build Status](https://camo.githubusercontent.com/237954ffe6ab01b7b846259f87297308c83576a2a5170b94d60e98c93f327dca/68747470733a2f2f7472617669732d63692e6f72672f796f73796d666f6e792f487474705365727665722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yosymfony/HttpServer)

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

[](#installation)

Use [Composer](http://getcomposer.org/) to install Yosyfmony HttpServer package:

Add the following to your `composer.json` and run `composer update`.

```
"require": {
    "yosymfony/httpserver": "1.3.x"
}

```

More information about the package on [Packagist](https://packagist.org/packages/yosymfony/httpserver).

How to use?
-----------

[](#how-to-use)

It's simple. The RequestHandler need a function for managing each connection:

```
$requestHandler = new RequestHandler(function($request) {
    return 'Hi Yo! Symfony';
});

$server = new HttpServer($requestHandler);
$server->start();

// go to http://localhost:8080

```

How to configure the RequestHandler?
------------------------------------

[](#how-to-configure-the-requesthandler)

**You can configure port and host for listening requests**:

```
$requestHandler = new RequestHandler( function($request) {
    return 'Hi Yo! Symfony';
});

$requestHandler->listen(8081, '127.0.0.1');

```

The defatult values:

- port: 8080
- host: 0.0.0.0

### The handler function

[](#the-handler-function)

The handler function receives a unique parameter to describe the resquest. By default, this argument is a object type [React\\Http\\Request](https://github.com/reactphp/http/blob/master/src/Request.php). If you want to receive a [Symfony HttpFoundation Request](http://symfony.com/doc/current/components/http_foundation/introduction.html#request)you need active this mode:

```
$requestHandler = new RequestHandler( function($request) {
    return 'Hi Yo! Symfony';
});

$requestHandler
    ->listen(8081, '127.0.0.1')
    ->enableHttpFoundationRequest(); // $requestHandler uses fluent interface

```

In case you want to use a HttpKernelInterface like Symfony, Silex or Laravel, simple use the `HttpKernelRequestHandler` handler like this:

```
// Create our kernel.
$httpKernel = new ExampleHttpKernel();
$options = array(
    'host' => '127.0.0.1',
    'port' => 8081,
);

// Wrap it with the RequestHandler.
$handler = new \Yosymfony\HttpServer\HttpKernelRequestHandler($httpKernel, $options);

// Start the server using the RequestHandler.
$server = new \Yosymfony\HttpServer\HttpServer($handler);
$server->start();

```

The response
------------

[](#the-response)

The most simple use-case is return a string. By default the `Content-Type` value is `text/plain` at the response header:

```
$requestHandler = new RequestHandler( function($request) {
    return 'Hi Yo! Symfony';
});

```

If you want customize the status code and the response header you can return a array like this:

```
requestHandler = new RequestHandler( function($request) {
    return [
        'content' => 'Hi Yo! Symfony',
        'headers' => ['Content-Type' => 'text/xml'],
        'status_code' => 200
    ];
});

```

The best way to make a response is using [Response from Symfony HttpFoundation](http://symfony.com/doc/current/components/http_foundation/introduction.html#response):

```
use Symfony\Component\HttpFoundation\Response;

requestHandler = new RequestHandler( function($request) {
    return new Response(
        'Hi Yo! Symfony',
        Response::HTTP_OK,
        array('content-type' => 'text/html')
    );
});

```

Unit tests
----------

[](#unit-tests)

You can run the unit tests with the following command:

```
$ cd your-path/vendor/yosymfony/httpserver
$ composer.phar install --dev
$ phpunit

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 89.7% 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 ~211 days

Total

5

Last Release

3411d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v1.3.0PHP &gt;=5.5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3321099?v=4)[Yo! Symfony](/maintainers/yosymfony)[@yosymfony](https://github.com/yosymfony)

---

Top Contributors

[![yosymfony](https://avatars.githubusercontent.com/u/3321099?v=4)](https://github.com/yosymfony "yosymfony (26 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (2 commits)")[![elnur](https://avatars.githubusercontent.com/u/821060?v=4)](https://github.com/elnur "elnur (1 commits)")

---

Tags

httprequestserverreact

### Embed Badge

![Health badge](/badges/yosymfony-httpserver/health.svg)

```
[![Health](https://phpackages.com/badges/yosymfony-httpserver/health.svg)](https://phpackages.com/packages/yosymfony-httpserver)
```

###  Alternatives

[psr/http-server-handler

Common interface for HTTP server-side request handler

177101.3M921](/packages/psr-http-server-handler)[friendsofsymfony/http-cache-bundle

Set path based HTTP cache headers and send invalidation requests to your HTTP cache

43813.2M47](/packages/friendsofsymfony-http-cache-bundle)[middlewares/request-handler

Middleware to execute request handlers

451.6M26](/packages/middlewares-request-handler)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)[swoole-bundle/swoole-bundle

Open/Swoole Symfony Bundle

6650.4k](/packages/swoole-bundle-swoole-bundle)[php-http/react-adapter

React HTTP Adapter

19260.9k3](/packages/php-http-react-adapter)

PHPackages © 2026

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