PHPackages                             itnelo/reactphp-foundation - 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. itnelo/reactphp-foundation

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

itnelo/reactphp-foundation
==========================

Some hull parts and scrap to bootstrap an elegant spacecraft w/ ReactPHP

0.3.0(5y ago)16MITPHPPHP &gt;=7.4

Since Jun 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/itnelo/reactphp-foundation)[ Packagist](https://packagist.org/packages/itnelo/reactphp-foundation)[ Docs](https://github.com/itnelo/reactphp-foundation)[ RSS](/packages/itnelo-reactphp-foundation/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (3)Dependencies (12)Versions (5)Used By (0)

ReactPHP Foundation
===================

[](#reactphp-foundation)

- [What's inside?](#whats-inside)
- [Installation](#installation)
    - [Docker Swarm](#docker-swarm)
- [Tests](#tests)
- [See also](#see-also)
- [Changelog](#changelog)

What's inside?
--------------

[](#whats-inside)

This skeleton for self-sufficient, asynchronous microservice contains:

- Interfaces
    - `psr/log` — PSR-3 (Logger)
    - `psr/http-message` — PSR-7 (HTTP Message)
    - `psr/container` — PSR-11 (Container)
- Decoupling code via Symfony's container
    - `symfony/dependency-injection`
- Ensure the non-blocking I/O with ReactPHP components
    - `react/event-loop`
    - `react/http`
    - `react/stream`
- Managing environment and configurations
    - `symfony/dotenv`
    - `symfony/config`
    - `symfony/yaml`

It follows strong SOLID design and fully PSR-compatible, built with PHP 7.4+ features in mind (starting with typed properties).

It is also *relatively* lightweight and takes benefits from both [Symfony](https://github.com/symfony/symfony) components and [ReactPHP](https://github.com/reactphp/reactphp)without raising up a heavy artillery setup.

There are a few deployment configurations ([Docker Compose](https://docs.docker.com/compose) project and stack for [Docker Swarm](https://docs.docker.com/engine/swarm/key-concepts), featuring [HAProxy](https://www.haproxy.com) as a load balancer for your code).

Installation
------------

[](#installation)

### Docker Swarm

[](#docker-swarm)

This setup provides a basic service scalability using [Swarm mode](https://docs.docker.com/engine/swarm/key-concepts). For testing purposes, let's assume we have the following servers:

```
192.169.56.1    # our pc, manager node; haproxy
192.169.56.10   # vm, worker node; app instance
192.169.56.20   # vm, worker node; app instance
192.169.56.30   # vm, worker node; app instance

```

**Pre-requirements**. Ensure all necessary ports are accessible on each machine or it may cause implicit problems during communication between nodes. A common symptom is a successful `nslookup` for all replicas within overlay, but a failed `ping` of some of them. Here is a quick list:

```
$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       192.169.56.0/24
2376/tcp                   ALLOW       192.169.56.0/24
2377/tcp                   ALLOW       192.169.56.0/24
4789/udp                   ALLOW       192.169.56.0/24
7946/tcp                   ALLOW       192.169.56.0/24
7946/udp                   ALLOW       192.169.56.0/24

```

**Limitations**. This setup assumes you are using a single haproxy instance, on the fixed node in the cluster and only that node will have its ports published:

[![how it works schema](https://github.com/itnelo/reactphp-foundation/raw/master/.github/images/how_it_works_schema.png)](https://github.com/itnelo/reactphp-foundation/blob/master/.github/images/how_it_works_schema.png)

**Step 1**. Create a manager node (for haproxy with exposed ports):

```
# our pc
$ docker swarm init --advertise-addr 192.169.56.1

```

And a few worker nodes:

```
# vm
$ docker swarm join --token JOIN_TOKEN --advertise-addr 192.169.56.10 192.169.56.1

```

where `JOIN_TOKEN` is a parameter obtained by `docker swarm join-token worker` on the manager node. Repeat this action for all other worker servers in your cluster using their own advertise addresses.

**Step 2**. Assign geography labels to be able to evenly distribute containers between all available servers:

```
# our pc
$ docker node update --label-add provider_location_machine=do.fra1.d1 HOSTNAME

```

where `HOSTNAME` is a server identifier, see `docker node ls` on the manager node.

**Step 3**. Clone the repository and adjust environment variables:

```
# our pc
$ git clone git@github.com:itnelo/reactphp-foundation.git my-service && cd "$_"
$ cp .env.dev.dist .env

```

Fill `APP_STACK_IMAGE_NAME` and `APP_STACK_IMAGE_VERSION` with your image metadata from the desired registry.

**Step 4**. Apply stack configuration:

```
# our pc
$ set -a; . .env; set +a && envsubst < docker-compose.stack.yml.dist > docker-compose.stack.yml

```

You should also adjust placement constraints (according to **Step 2**) to ensure Swarm scheduler is able to assign tasks to the configured nodes. Check `haproxy.stack.cfg` from the `docker` directory if you have changed some ports or just use a custom haproxy image as well.

**Step 5**. Deploy services:

```
# our pc
$ docker stack deploy --orchestrator swarm --compose-file docker-compose.stack.yml my-service

```

By accessing `192.169.56.1:6637/stats` (if you stick to the default configuration; use your manager node IP) a rendered page with backend statistics should be available:

[![haproxy stats](https://github.com/itnelo/reactphp-foundation/raw/master/.github/images/haproxy_stats.png)](https://github.com/itnelo/reactphp-foundation/blob/master/.github/images/haproxy_stats.png)

To rebalance app replicas between nodes, after one is added or removed, use:

```
# our pc
$ docker service update --force my-service_app

```

Tests
-----

[](#tests)

Apply test suite configuration and run [phpunit](https://github.com/sebastianbergmann/phpunit):

```
$ cp phpunit.xml.dist phpunit.xml

# for docker-compose installation
$ docker-compose run --rm app bin/phpunit

```

See also
--------

[](#see-also)

- [driftphp/driftphp](https://github.com/driftphp/driftphp) — If you are looking for a deeper Symfony integration, with Kernel adaptation to async environment.
- [thesecretlivesofdata.com/raft](http://thesecretlivesofdata.com/raft/) — A helpful visualization to understand how the distributed consensus algorithm, used by Docker Swarm, works.

Changelog
---------

[](#changelog)

All notable changes to this project will be documented in [CHANGELOG.md](CHANGELOG.md).

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~58 days

Total

4

Last Release

1980d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9846fb3e0b9baad2f926476f9b5e6a032909ff9d8cbd0b01074a677d64822b4b?d=identicon)[itnelo](/maintainers/itnelo)

---

Top Contributors

[![itnelo](https://avatars.githubusercontent.com/u/2988715?v=4)](https://github.com/itnelo "itnelo (35 commits)")

---

Tags

docker-composedocker-swarmmicroservicemicroservice-architecturephp74reactphpskeleton

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/itnelo-reactphp-foundation/health.svg)

```
[![Health](https://phpackages.com/badges/itnelo-reactphp-foundation/health.svg)](https://phpackages.com/packages/itnelo-reactphp-foundation)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)

PHPackages © 2026

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