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

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

weew/http-app
=============

Http version of the weew/app package.

v2.11.0(9y ago)01644MITPHP

Since Jan 11Pushed 9y ago1 watchersCompare

[ Source](https://github.com/weew/http-app)[ Packagist](https://packagist.org/packages/weew/http-app)[ RSS](/packages/weew-http-app/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (25)Used By (4)

Http App
========

[](#http-app)

[![Build Status](https://camo.githubusercontent.com/3aa27bbdaac9b7d053da15f1674cd487b7fe1cbdc19296cb35fd94f5cbae545b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f776565772f687474702d6170702e737667)](https://travis-ci.org/weew/http-app)[![Code Quality](https://camo.githubusercontent.com/2f192db4f79a3c2ca0175e60b9dbb5a2fe6e0f47055ff20cbabb0cf68a28b083/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f776565772f687474702d6170702e737667)](https://scrutinizer-ci.com/g/weew/http-app)[![Test Coverage](https://camo.githubusercontent.com/432115f4b1e870380fb2efc72f057ceea2b672f64bc9777df7885e8f57b5239c/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f776565772f687474702d6170702e737667)](https://coveralls.io/github/weew/http-app)[![Version](https://camo.githubusercontent.com/6086167fcb6d7a29342a55cac7f79df24d4f9a137be5d39a613b6ec744a402ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776565772f687474702d6170702e737667)](https://packagist.org/packages/weew/http-app)[![Licence](https://camo.githubusercontent.com/2fd6014658c566180474e6227e529253c8291abecc936e5a0e4e9a35de744c40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f776565772f687474702d6170702e737667)](https://packagist.org/packages/weew/http-app)

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

[](#table-of-contents)

- [Installation](#installation)
- [Introduction](#introduction)
- [Usage](#usage)
- [Environment awareness](#environment-awareness)
- [Extensions](#extensions)

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

[](#installation)

`composer require weew/http-app`

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

[](#introduction)

This is a very minimalistic wrapper for a http application.

Usage
-----

[](#usage)

The whole app lifecycle is event based. To successfully handle http requests you must handle the `HandleHttpRequestEvent` and provide a valid response that implements the `IHttpResponse` interface.

Below is a very basic example of how you might implement this.

```
$app = new HttpApp();
$app->getEventer()
    ->subscribe(HandleHttpRequestEvent::class, function(HandleHttpRequestEvent $event) {
        $request = $event->getRequest();

        // handle request (do some routing, call a controller, etc.)
        // provide a response that implements the IHttpResponse interface
        $event->setResponse($response);
    });
```

There is already an existing implementation for this, see [weew/http-app-request-handler](https://github.com/weew/http-app-request-handler).

Environment awareness
---------------------

[](#environment-awareness)

Sometimes you might want, for example during tests, to send a request to the same front controller but in a different environment. Symfony does this using different front controllers: `app.php` and `app_dev.php`. This approach will however alter the url and might not be suitable in some situations. Beside creating different front controllers you can also specify an environment using the `x-env: dev` header or a query param `?env=dev` or a somewhere inside your url `/env=dev/some/url`. If an environment setting can be detected either via headers or url query or url part, the corresponding data (x-env header, env query param, env value inside the url) will be automatically removed. This feature is disabled by default and you can enable it by setting `debug` to true.

```
$app->setDebug(true);
$request = new HttpRequest();

$request->getHeaders()->set('x-env', 'stage');
// or
$request->getUrl()->getQuery()->set('env', 'stage');
// or
$request->getUrl()->setPath('/env=stage/some/url');

// app will run in the "stage" environment
$app->handle($request);
```

You must not use this in production! This is why it is disabled by default. Only enable this feature for your dev environment.

Extensions
----------

[](#extensions)

There are several extensions available:

- [weew/http-app-request-handler](https://github.com/weew/http-app-request-handler)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity73

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

Recently: every ~24 days

Total

24

Last Release

3625d ago

Major Versions

v1.5.1 → v2.0.02016-02-22

### Community

Maintainers

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.6k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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