PHPackages                             progphil1337/simple-react-app - 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. progphil1337/simple-react-app

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

progphil1337/simple-react-app
=============================

0194↓90%1PHP

Since Mar 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/progphil1337/simple-react-app)[ Packagist](https://packagist.org/packages/progphil1337/simple-react-app)[ RSS](/packages/progphil1337-simple-react-app/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Simple ReactPHP App
===================

[](#simple-reactphp-app)

Simple and fast configuration solution

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

[](#installation)

Install with composer:

```
$ composer require progphil1337/simple-react-app
```

Compatibility
-------------

[](#compatibility)

`ProgPhil1337\SimpleReactApp` requires PHP 8.1 (or better).

Usage
-----

[](#usage)

### Basic example

[](#basic-example)

#### Run your app

[](#run-your-app)

```
$ php app.php
```

Example output

```
[INFO] Registering GET /
[INFO] Server running on 127.0.0.1:1337
```

#### app.php

[](#appphp)

```
use Progphil1337\Config\Config;
use ProgPhil1337\DependencyInjection\ClassLookup;
use ProgPhil1337\DependencyInjection\Injector;
use ProgPhil1337\SimpleReactApp\App;
use ProgPhil1337\SimpleReactApp\FileSystem\Pipeline\FileSystemPipelineHandler;
use ProgPhil1337\SimpleReactApp\HTTP\Request\Pipeline\DefaultRequestPipelineHandler;
use ProgPhil1337\SimpleReactApp\HTTP\Request\Pipeline\RoutingPipelineHandler;

require_once 'vendor/autoload.php';

const PROJECT_PATH = __DIR__;

$config = Config::create(__DIR__ . '/config.yml');

$classLookup = (new ClassLookup())
    ->singleton($config)
    ->singleton(Injector::class)
    ->register($config);

$container = new Injector($classLookup);

$app = new App($config, $container);

return $app->run([
    FileSystemPipelineHandler::class,
    RoutingPipelineHandler::class,
    DefaultRequestPipelineHandler::class
]);
```

#### config.yml

[](#configyml)

```
host: 127.0.0.1
port: 1337
public_dir: public
routing:
  cache: route.cache
handlers: App/Handler
```

#### App/Handler/IndexHandler.php

[](#apphandlerindexhandlerphp)

```
#[Route(HttpMethod::GET, '/')]
class IndexHandler implements HandlerInterface
{
    public function process(ServerRequestInterface $serverRequest, RouteParameters $parameters): ResponseInterface
    {
        return new JSONResponse(['message' => 'Hello World']);
    }
}
```

---

### Interface binding example

[](#interface-binding-example)

If you type-hint an **interface** in your handler's or service's constructor , you must register two additional things in your `ClassLookup` bootstrap:

1. `->alias(Interface::class, Concrete::class)` — maps the interface to its concrete implementation
2. `->register($classLookup)` — registers the configured instance itself, so the injector doesn't create a blank one at request time

Without these, you will get the following runtime error when a request hits the endpoint:

```
Cannot instantiate interface App\Service\SomeInterface

```

> ⚠️ This error only appears at **request time**, not on startup — making it easy to miss.

#### app.php

[](#appphp-1)

```
use Progphil1337\Config\Config;
use ProgPhil1337\DependencyInjection\ClassLookup;
use ProgPhil1337\DependencyInjection\Injector;
use ProgPhil1337\SimpleReactApp\App;
use ProgPhil1337\SimpleReactApp\FileSystem\Pipeline\FileSystemPipelineHandler;
use ProgPhil1337\SimpleReactApp\HTTP\Request\Pipeline\DefaultRequestPipelineHandler;
use ProgPhil1337\SimpleReactApp\HTTP\Request\Pipeline\RoutingPipelineHandler;
use App\Service\SomeInterface;
use App\Service\SomeConcreteClass;

require_once 'vendor/autoload.php';

const PROJECT_PATH = __DIR__;

$config = Config::create(__DIR__ . '/config.yml');

$classLookup = (new ClassLookup());
$classLookup
    ->singleton(ClassLookup::class)
    ->alias(SomeInterface::class, SomeConcreteClass::class)
    ->singleton($config)
    ->singleton(Injector::class)
    ->register($config)
    ->register($classLookup); // ← must be THIS instance, not a new one

$container = new Injector($classLookup);

$app = new App($config, $container);

return $app->run([
    FileSystemPipelineHandler::class,
    RoutingPipelineHandler::class,
    DefaultRequestPipelineHandler::class
]);
```

#### App/Handler/SomeHandler.php

[](#apphandlersomehandlerphp)

```
use App\Service\SomeInterface;

#[Route(HttpMethod::GET, '/some-route')]
class SomeHandler implements HandlerInterface
{
    public function __construct(
        private readonly SomeInterface $service // ← injected via alias
    ) {}

    public function process(ServerRequestInterface $serverRequest, RouteParameters $parameters): ResponseInterface
    {
        return new JSONResponse(['result' => $this->service->doSomething()]);
    }
}
```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance54

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 88.9% 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/fe0febabf0b72bbeb1eaa56bb63cd3b97c9f8eb8ffbb8d61ac8b74f934adc756?d=identicon)[progphil1337](/maintainers/progphil1337)

---

Top Contributors

[![progphil1337](https://avatars.githubusercontent.com/u/8302313?v=4)](https://github.com/progphil1337 "progphil1337 (8 commits)")[![sfmok](https://avatars.githubusercontent.com/u/6314298?v=4)](https://github.com/sfmok "sfmok (1 commits)")

### Embed Badge

![Health badge](/badges/progphil1337-simple-react-app/health.svg)

```
[![Health](https://phpackages.com/badges/progphil1337-simple-react-app/health.svg)](https://phpackages.com/packages/progphil1337-simple-react-app)
```

###  Alternatives

[ebanx/benjamin

Business rule provider lib for plugin implementations

18160.9k1](/packages/ebanx-benjamin)[sitegeist/inspectorgadget

Edit value objects in the inspector

1343.3k2](/packages/sitegeist-inspectorgadget)

PHPackages © 2026

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