PHPackages                             mattjmattj/plux - 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. mattjmattj/plux

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

mattjmattj/plux
===============

Librairy for implementing a Flux-like one-direction flow architecture server-side

210[1 issues](https://github.com/mattjmattj/plux/issues)PHP

Since Feb 16Pushed 11y ago1 watchersCompare

[ Source](https://github.com/mattjmattj/plux)[ Packagist](https://packagist.org/packages/mattjmattj/plux)[ RSS](/packages/mattjmattj-plux/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

plux
====

[](#plux)

[![Build Status](https://camo.githubusercontent.com/013afff7c22a6f8040d281c2146a8da271e0542290eb4dd63c6aaf972cb65b22/68747470733a2f2f7472617669732d63692e6f72672f6d6174746a6d6174746a2f706c75782e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mattjmattj/plux) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/f56e0e974909071328c41114c1a6ad2422709996fb0b1691fe05564b74080050/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174746a6d6174746a2f706c75782f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mattjmattj/plux/?branch=master) [![Code Coverage](https://camo.githubusercontent.com/4c9214c3c6910115446ca4e4b2de7083c6ab965d16d826fff570898652aab864/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6174746a6d6174746a2f706c75782f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mattjmattj/plux/?branch=master)

introduction
------------

[](#introduction)

**plux** is a PHP library created to answer a simple question:

> *Does implementing a [Flux](http://facebook.github.io/flux/docs/overview.html)-like, one-direction flow architecture server-side make any sense?*

quick how-to
------------

[](#quick-how-to)

### installation

[](#installation)

```
composer require mattjmattj/plux

```

### initialization

[](#initialization)

Somewhere in the bootstrap of your application/framework you need to call

```
\Plux\Plux::initialize();
```

Plux will then create a Dispatcher that will have to handle the Actions and pass them to your registerd Stores.

### stores

[](#stores)

Stores are like the ones in Flux. They should do the business part according to an action that is given to them through their `handle` method. Note that using the `handle` method is just a shortcut provided by the StoreTrait, but any *callable* can be used with the Dispatcher.

You must register your Stores to Plux and give them a name :

```
\Plux\Plux::addStore('Foo', new \My\Super\Store\Bar());
```

The name will allow other parts of your application to call

```
\Plux\Plux::getStore('Foo');
```

Stores are supposed to emit events whenever they perform an action. Plux depends on [evenement/evenement](https://github.com/igorw/evenement) to implement Store events.

### actions

[](#actions)

Actions must be created and dispatched to allow registered Stores to do their job. Actions are composed of two elements:

- a *type*
- a *data* array

After creating an action, you must dispatch it :

```
$action = new \Plux\Action ('type', ['foo' => 'bar']);
\Plux\Plux::getDispatcher()->dispatch($action);
```

### components

[](#components)

Theoretically everybody can listen to Store events, but to make things easier Plux provides a Component trait with a single `render` function. When `render`is called the Component should output whatever it needs to. This part is left very opened and you are not forced to use the Component trait at all.

example
-------

[](#example)

A small but complete example of implementation is available [here](https://github.com/mattjmattj/plux-demo)

debate
------

[](#debate)

You think that even in a per-request context like in PHP, implementing a one-direction flow architecture is a great idea? You think that it is absurd? Do not hesitate and leave a comment in the [dedicated issue](https://github.com/mattjmattj/plux/issues/1)

license
-------

[](#license)

plux is released under the [FreeBSD License](http://opensource.org/licenses/BSD-2-Clause)

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f3dcd17447ceec1afbedb4b996b0365645feb858ebb7c9d161566343faaeb66d?d=identicon)[mattjmattj](/maintainers/mattjmattj)

---

Top Contributors

[![mattjmattj](https://avatars.githubusercontent.com/u/1842012?v=4)](https://github.com/mattjmattj "mattjmattj (30 commits)")

### Embed Badge

![Health badge](/badges/mattjmattj-plux/health.svg)

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

###  Alternatives

[mediawiki/semantic-scribunto

A Semantic Mediawiki extension to natively support the Scribunto extension

3071.2k](/packages/mediawiki-semantic-scribunto)

PHPackages © 2026

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