PHPackages                             ctefan/redux - 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. ctefan/redux

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

ctefan/redux
============

A PHP port of Redux

0.1.0(7y ago)15MITPHPPHP ^7.2

Since Oct 30Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Cmytxy/redux-php)[ Packagist](https://packagist.org/packages/ctefan/redux)[ RSS](/packages/ctefan-redux/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

redux-php
=========

[](#redux-php)

[![Build Status](https://camo.githubusercontent.com/ef3cbd83c3e577914ccb94cb013f27f5f1c7845fb9a6c507b3e887e62746c556/68747470733a2f2f7472617669732d63692e636f6d2f436d797478792f72656475782d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/Cmytxy/redux-php)

[![Build Status](https://camo.githubusercontent.com/50ee16e7fdb4fd1c85145669495cc9c50c7803a3096ddc99be6c6247a7b3464d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436d797478792f72656475782d7068702f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Cmytxy/redux-php/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f5302235faa74fffc5faa229e98ef151424d92737686c252130ca4306dd158f9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436d797478792f72656475782d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Cmytxy/redux-php/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/49b4c9bfa652bcff41b0c967a42d2a063ec590a8d8f39d47f4620be393f18a4d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436d797478792f72656475782d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Cmytxy/redux-php/?branch=master)

A PHP port of [Redux](https://github.com/reduxjs/redux/blob/master/src/applyMiddleware.js). Partly inspired by the ports of [RafaelFontes](https://github.com/RafaelFontes/php-mars)and [rikbruil](https://github.com/rikbruil/php-redux).

Background
----------

[](#background)

This library was created to be used in a framework for interactive cli applications.

Example usage
-------------

[](#example-usage)

### Reducers

[](#reducers)

```
// Create a reducer.
$reducer = function($state, ActionInterface $action) {
    switch ($action->getType()) {
        case 'add':
            $state += $action->getPayload();
            break;
        case 'subtract':
            $state -= $action->getPayload();
            break;
    }
    return $state;
};
$initialState = 0;

// Create the store.
$store = Redux::createStore($reducer, $initialState);

// Dispatch some actions.
$store->dispatch(new Action('add', 5));
$store->dispatch(new Action('subtract', 2));

assert(3 === $store->getState());
```

### Middleware

[](#middleware)

Middleware are just callables. If you don't want to use closures, you can extend `Ctefan\Redux\Middleware\AbstractMiddleware` and implement method `handleAction(ActionInterface $action, callable $next)`.

```
// Create the middleware.
$middleware = function(callable $getState, callable $dispatch): callable {
    return function($next): callable {
        return function(ActionInterface $action) use ($next) {
            // TODO do something like fetching data from a remote server, waiting for a promise etc.
            return $next($action);
        }
    }
};

// Create the store.
$store = Redux::createStore($reducer, $initialState, Redux::applyMiddleware($middleware));
```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2756d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1127758?v=4)[ctefan](/maintainers/ctefan)[@ctefan](https://github.com/ctefan)

---

Top Contributors

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

---

Tags

reduxstate-managementfluxredux

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ctefan-redux/health.svg)

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

###  Alternatives

[react/stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP

688126.8M194](/packages/react-stream)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34076.1M136](/packages/react-child-process)[alchemy/binary-driver

A set of tools to build binary drivers

19110.9M39](/packages/alchemy-binary-driver)[react/zmq

ZeroMQ bindings for React.

2471.7M31](/packages/react-zmq)[selvinortiz/flux

Fluent regular expressions in PHP.

3372.0k1](/packages/selvinortiz-flux)

PHPackages © 2026

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