PHPackages                             stack/inline - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. stack/inline

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stack/inline
============

Inline stack middleware.

52272[1 issues](https://github.com/stackphp/inline/issues)[1 PRs](https://github.com/stackphp/inline/pulls)1PHP

Since Apr 9Pushed 11y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (1)

Stack/Inline
============

[](#stackinline)

Inline stack middleware.

Enables the usage of callables as stack middlewares.

Example
-------

[](#example)

Here is a contrived example showing how a callable can be used to easily act as a stack middleware for a silex application:

```
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;

$app = new Silex\Application();

$app->get('/', function (Request $request) {
    if ('success' === $request->attributes->get('callable_middleware')) {
        return new Response('SUCCESS');
    }

    return new Response('FAILED', 500);
});

$inlineMiddleware = function(
    HttpKernelInterface $app,
    Request $request,
    $type = HttpKernelInterface::MASTER_REQUEST,
    $catch = true
) {
    $request->attributes->set('callable_middleware', 'success');

    $response = $app->handle($request, $type, $catch);
    $response->setContent('['.$response->getContent().']');

    return $response;
};

$stack = (new Stack\Builder())
    ->push('Stack\Inline', $inlineMiddleware);

$app = $stack->resolve($app);

```

Usage
-----

[](#usage)

The method signature for the callable is similar to `HttpKernelInterface::handle`except that it requires an `HttpKernelInterface` instance as its first argument. A simple passthru inline middleware would look like this:

```
$app = new Stack\Inline($app, function(
    HttpKernelInterface $app,
    Request $request,
    $type = HttpKernelInterface::MASTER_REQUEST,
    $catch = true
) {
    return $app->handle($request, $type, $catch);
});

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3afcc18d00fff840775bbf9570b3e9cd3997ca4820b9bfb14caf6da3ae580370?d=identicon)[igorw](/maintainers/igorw)

---

Top Contributors

[![simensen](https://avatars.githubusercontent.com/u/191200?v=4)](https://github.com/simensen "simensen (8 commits)")[![igorw](https://avatars.githubusercontent.com/u/88061?v=4)](https://github.com/igorw "igorw (2 commits)")

### Embed Badge

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

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

PHPackages © 2026

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