PHPackages                             laasti/stack - 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. laasti/stack

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

laasti/stack
============

From request to response. A middleware stack with 3 phases: prepare, respond and close

v1.0(10y ago)0190[1 PRs](https://github.com/Laasti/stack/pulls)1MITPHPPHP &gt;=5.4.0

Since Mar 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Laasti/stack)[ Packagist](https://packagist.org/packages/laasti/stack)[ RSS](/packages/laasti-stack/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (2)Versions (5)Used By (1)

Laasti/Stack
============

[](#laastistack)

A middleware stack with 3 phases:

1. Prepare is where you adapt the request;
2. Respond is where you modify the response generated by the prepare phase;
3. Close is where you output the response and close the current request (ie. closing a session, sending an e-mail...);

Laasti\\Stack has 1 dependency: [symfony/http-foundation](https://github.com/symfony/HttpFoundation). I chose it because it handles requests and responses in a straightforward fashion. I am waiting for PSR7 to mature and will eventually remove the dependency on HttpFoundation in favour of the PSR7 standard.

It also provides an integration with League\\Container.

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

[](#installation)

```
composer require laasti/stack

```

Usage
-----

[](#usage)

Without League\\Container:

```
$stack = new Laasti\Stack\Stack;

//You must at least have one PrepareableMiddleware that returns a Response
$stack->push(new MyPrepareableMiddleware);

//Ouputs the response automatically
$stack->execute(Request::createFromGlobals());

```

With League\\Container:

```
$container = new League\Container\Container;
$resolver = new Laasti\Stack\ContainerResolver($container);
$stack = new Laasti\Stack\Stack($resolver);
$container->add('MyPrepareableMiddleware');

//You must at least have one PrepareableMiddleware that returns a Response
$stack->push('MyPrepareableMiddleware');

//Ouputs the response automatically
$stack->execute(Request::createFromGlobals());

```

> If you encounter problems with priority, make sure that your middlewares define just one of the middleware types. Also make sure your middlewares do as little as possible so that you can fine tune the priority more easily.

Contributing
------------

[](#contributing)

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

History
-------

[](#history)

See CHANGELOG.md for more information.

Credits
-------

[](#credits)

Author: Sonia Marquette (@nebulousGirl)

License
-------

[](#license)

Released under the MIT License. See LICENSE file.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Total

3

Last Release

3944d ago

Major Versions

v0.2 → v1.02015-08-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/48bb7fdba3e642d3dc668b9ff03ff949b9043f58096f3c85c13de508b53e7d68?d=identicon)[nebulousGirl](/maintainers/nebulousGirl)

---

Top Contributors

[![nebulousGirl](https://avatars.githubusercontent.com/u/1899256?v=4)](https://github.com/nebulousGirl "nebulousGirl (8 commits)")

### Embed Badge

![Health badge](/badges/laasti-stack/health.svg)

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

###  Alternatives

[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k853.6M8.2k](/packages/symfony-http-kernel)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k50.1M306](/packages/api-platform-core)[symfony/psr-http-message-bridge

PSR HTTP message bridge

1.3k312.3M926](/packages/symfony-psr-http-message-bridge)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k66.1M251](/packages/nelmio-api-doc-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k181.3M2.2k](/packages/symfony-security-bundle)

PHPackages © 2026

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