PHPackages                             spajak/flow - 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. spajak/flow

ActiveLibrary[Framework](/categories/framework)

spajak/flow
===========

Simple PHP application base

1.2.0(1mo ago)088MITPHPPHP &gt;=8.4CI passing

Since Feb 23Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependencies (30)Versions (8)Used By (0)

Flow
====

[](#flow)

Simple PHP HTTP &amp; CLI application base using:

- PSR-7 HTTP Message / PSR-17 HTTP Factories: [nyholm/psr7](https://github.com/Nyholm/psr7)
- PSR-15 HTTP Handlers / Middleware: [northwoods/broker](https://github.com/northwoods/broker)
- PSR-11: Container: [php-di/php-di](https://github.com/PHP-DI/PHP-DI)
- Routing: [nikic/fast-route](https://github.com/nikic/FastRoute)
- Console: [symfony/console](https://github.com/symfony/console)

Rationale
---------

[](#rationale)

- Basing on standardized interfaces and well tested components;
- Not being tied to any specific framework;
- Being able to make lightweight and customizable apps fast with just PHP's `include`s and anonymous functions.

Usage
-----

[](#usage)

```
$app = new Flow\Application;
```

Register services (using: [php-di/php-di](https://github.com/PHP-DI/PHP-DI)):

```
$services = [];
$services['hello'] = fn() => new class {
    public function sayHello($name) { return "Hello {$name}!"; }
};
$app->getContainerBuilder()->addDefinitions($services);
```

Register routes (using: [nikic/fast-route](https://github.com/nikic/FastRoute)):

```
$app->getRouteCollector()->get('/hello[/{name}]', function($request, $name = 'World') use ($app) {
    $container = $app->getContainer();
    $response = $container->get('http_factory')->createResponse(200);
    $response->getBody()->write(
        $container->get('hello')->sayHello($name)
    );
    return $response;
});
```

Register middleware (using: [northwoods/broker](https://github.com/northwoods/broker)):

```
$app->getBroker()->append(new MyMiddleware);
```

…or defer construction until after bootstrap when the middleware needs services from the container:

```
$app->getBroker()->appendDeferred(fn() => new MyMiddleware(
    $app->getContainer()->get('hello'),
));
```

Register console commands (using: [symfony/console](https://github.com/symfony/console)):

```
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

$app->getConsole()->register('hello')
    ->setDescription('Say hello')
    ->addArgument('name', null, 'Your name', 'World')
    ->setCode(function(InputInterface $input, OutputInterface $output) use ($app) {
        $service = $app->getContainer()->get('hello');
        $output->writeLn($service->sayHello($input->getArgument('name')));
        return 0;
    });
```

…or use factories to lazy-load commands:

```
use Flow\Command\RequestCommand;
use Flow\Emitter\ConsoleEmitter;

$commands = [];
$commands['request'] = fn() => new RequestCommand(
    $app->getServerRequestCreator(),
    $app->getBroker(),
    new ConsoleEmitter
);
$app->getCommandLoader()->addFactories($commands);
```

At the end of the script, simply run the application:

```
$app->run();
```

Try it from terminal:

```
$ php examples/application.php hello "Grim Reaper"
$ php examples/application.php request GET /hello
```

Lifecycle
---------

[](#lifecycle)

Append all middleware to the broker *before* calling `$app->run()`. The router middleware is appended last during bootstrap and terminates the pipeline on a matched route, so anything appended afterwards is unreachable for matched routes.

Tests &amp; static analysis
---------------------------

[](#tests--static-analysis)

```
$ composer test       # phpunit
$ composer analyse    # phpstan
```

License
-------

[](#license)

MIT

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance94

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

Recently: every ~21 days

Total

6

Last Release

32d ago

Major Versions

0.9.1 → 1.0.02026-04-26

PHP version history (2 changes)0.9.0PHP &gt;=8.2

0.9.1PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2893066?v=4)[Sebastian Pająk](/maintainers/spajak)[@spajak](https://github.com/spajak)

---

Top Contributors

[![spajak](https://avatars.githubusercontent.com/u/2893066?v=4)](https://github.com/spajak "spajak (32 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spajak-flow/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M200](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M560](/packages/shopware-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.7k](/packages/contao-core-bundle)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

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