PHPackages                             modulework/http - 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. [Framework](/categories/framework)
4. /
5. modulework/http

ActiveLibrary[Framework](/categories/framework)

modulework/http
===============

HTTP package for the MODULEWork Framework

v0.3(12y ago)120MITPHPPHP &gt;=5.3

Since Jul 22Pushed 12y ago1 watchersCompare

[ Source](https://github.com/MODULEWork/Http)[ Packagist](https://packagist.org/packages/modulework/http)[ RSS](/packages/modulework-http/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (4)Used By (0)

HTTP Package
------------

[](#http-package)

[![Latest Stable Version](https://camo.githubusercontent.com/7b6154037f4fee1efcac8f2c664391042ae087747c9e4282d898c182791940dc/68747470733a2f2f706f7365722e707567782e6f72672f4d4f44554c45576f726b2f487474702f762f737461626c652e706e67)](https://packagist.org/packages/MODULEWork/Http)[![Build Status](https://camo.githubusercontent.com/cc3303e230f0be7f40661e9cdc98ee3da7d3a66ff6f8505ebcfffeabd8fb1cbe/68747470733a2f2f7472617669732d63692e6f72672f4d4f44554c45576f726b2f487474702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/MODULEWork/Http)

The HTTP Package of the Modulework Framework.

It provides a convient way of handling HTTP request and HTTP response.

So for example you could already create a application with these two classes:

```
$req = Request::makeFromGlobals();

$content = 'Hello ' . $req->query->get('name', 'Stranger');

$res = Response::make($content);
$res->send();
```

This will app will great every vistor with their name or if the vistor didn' t provide the name in the query string it will fallback to "Stranger".

Of course this is a very basic example but it can do a lot more!

We could expand this and save the name into a cookie:

```
$req = Request::makeFromGlobals();

$name = $req->query->get('name', Stranger);
$content = 'Hello ' . $name;

$res = Response::make($content);
$res->addCookie(Cookie::make(
		'name',
		$name
));
$res->send();
```

Or check if the method is GET or POST, so a user could also POST it' s name:

```
$req = Request::makeFromGlobals();

$name = $req->query->get('name',
	$req->request->get('name', 'Stranger')
	);
// Or just getting the method:
$method = $req->getMethod();

$content = 'Hello ' . $name;

$res = Response::make($content);
$res->addCookie(Cookie::make(
		'name',
		$name
		));
$res->send();
```

Or display the client' s IP:

```
echo Request::makeFromGlobals()->getClientIp();
```

Now we also send a cookie a too the user. But we can do even more:

```
$res = Response::make()
->setContent('Foo')
->setStatusCode(200)
->addHeader('Expire', 'never')
->setDate(new DateTime)
->addCookie(Cookie::make('foo')
	->setValue('bar')
	->setSecure(false)
	->setHttpOnly(false)
)
->prepare($request)
->send();
```

**Chained methods! Custom Headers! Custom Status Codes! And much more!**

The Response class is intelligent enough to set the status code, if a redirect is issued:

```
$res = Response::make()
->addHeader('Location', 'foo.bar')
->prepare($request)
->send()
```

Will result in this header

```
HTTP/1.0 302 Found
Location: foo.bar
Date [...]

```

But the Request class can do even more, we can use it for very basic routing:

```
$req = Request::makeFromGlobals();
if ('/' == $req->getPath()) {
    echo "You are on the homepage"
} elseif ('/foo/bar' == $req->getPath()) {
    echo "You are on the bar page of foo!"
}
```

This is very basic and not best practice, but it shows for what we can use this class for!

There are also some more Response classes, like the RedirectResponse and JsonResponse class.

Here is an usage example:

```
$res = RedirectResponse::make('http://foo.bar')
->withCookie(Cookie::make('foo'))
->prepare(Request::makeFromGlobals)
->send();
```

As you can see very easy to use. *NOTE!* This is just a **wrapper** for a normal Response. You could also do this:

```
$res = Response::make('', 302, array('Location' => 'http://foo.bar'))
->addCookie(Cookie::make('foo'))
->prepare(Request::makeFromGlobals)
->send();
```

The only thing what is not shown in the alternative way is the HTML meta redirect (in case the header doesn' t fire).

The JsonResponse class is pretty straight forward as well:

```
$res = JsonResponse::make(array('foo' => 'bar'))
->prepare(Request::makeFromGlobals)
->send();
```

This would result in this response:

```
HTTP/1.0 200 OK
Content-Type application/json
Date [...]

{"foo": "bar"}

```

Pretty nifty, eeh!!?

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

4688d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2886317?v=4)[Christian Gärtner](/maintainers/ChristianGaertner)[@ChristianGaertner](https://github.com/ChristianGaertner)

---

Top Contributors

[![ChristianGaertner](https://avatars.githubusercontent.com/u/2886317?v=4)](https://github.com/ChristianGaertner "ChristianGaertner (118 commits)")

---

Tags

framework

### Embed Badge

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

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

###  Alternatives

[hemp/presenter

Easy Model Presenters in Laravel

247608.3k1](/packages/hemp-presenter)[pestphp/pest-plugin-stressless

Stressless plugin for Pest

68943.9k18](/packages/pestphp-pest-plugin-stressless)[wpstarter/framework

The WpStarter Framework - Laravel Framework for WordPress

1610.2k5](/packages/wpstarter-framework)

PHPackages © 2026

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