Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 17, 2024 via composer

stack/builder v1.0.6

Builder for stack middleware based on HttpKernelInterface.
Package summary
Share
0
issues
1
license
14
MIT
Package created
9 Apr 2013
Version published
30 Jan 2020
Maintainers
1
Total deps
14
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
14 Packages, Including:
psr/event-dispatcher@1.0.0
psr/log@2.0.0
stack/builder@v1.0.6
symfony/deprecation-contracts@v3.5.0
symfony/error-handler@v6.3.12
symfony/event-dispatcher@v6.4.7
symfony/event-dispatcher-contracts@v3.5.0
symfony/http-foundation@v5.4.39
symfony/http-kernel@v5.4.39
symfony/polyfill-ctype@v1.29.0
symfony/polyfill-mbstring@v1.29.0
symfony/polyfill-php73@v1.29.0
symfony/polyfill-php80@v1.29.0
symfony/var-dumper@v6.4.7
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of stack/builder 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
symfony/http-foundationv5.4.39-MIT
prod dev
symfony/http-kernelv5.4.39-MIT
prod dev

Visualizations

Frequently Asked Questions

What does stack/builder do?

Stack/Builder is a compact library that assists developers in constructing a nested HttpKernelInterface decorator tree, effectively modeling it as a stack of middlewares. This gives developers the ability to handle complex software environments by simplifying the process of arranging layers within them. Stack/Builder works as a middleware on top of PHP applications, making HTTP requests more manageable.

How do you use stack/builder?

To effectively use the Stack/Builder in your projects, the library first needs to be instantiated. Here's an example of how to use Stack/Builder to simplify and manage HTTP requests as a stack of middlewares.

First, decorate a silex app with session and cache middlewares:

$app = new Silex\Application();
$app->get('/', function () {
    return 'Hello World!';
});

$app = new Stack\Session(
    new Symfony\Component\HttpKernel\HttpCache\HttpCache($app, new Store(__DIR__.'/cache'))
);

To use Stack/Builder to simplify that:

$stack = (new Stack\Builder())
    ->push('Stack\Session')
    ->push('Symfony\Component\HttpKernel\HttpCache\HttpCache', new Store(__DIR__.'/cache'));

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

Next, create a serve request:

$request = Request::createFromGlobals();
$response = $app->handle($request)->send();
$app->terminate($request, $response);

Stack/Builder also allows you to use a callable for more complex middleware instantiation situations:

$stack = (new Stack\Builder())
    ->push('Stack\Session')
    ->push(function ($app) {
        $cache = new HttpCache($app, new Store(__DIR__.'/cache'));
        return $cache;
    });

Where are the stack/builder docs?

The documentation for Stack/Builder could be found within the README file available on the GitHub repository at https://github.com/stackphp/builder.git. It provides useful examples and clear instructions on how to use the library to handle complex HTTP requests effortlessly. Until now, there doesn't appear to be a separate, dedicated documentation site or document outside of the README file in the repository.