PHPackages                             ereborcodeforge/mithrilphp - 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. ereborcodeforge/mithrilphp

ActiveLibrary[Framework](/categories/framework)

ereborcodeforge/mithrilphp
==========================

MithrilPHP is a lightweight and resilient PHP engine that silently protects applications, offering a solid core runtime, console, and HTTP foundation without dictating how your domain is built.

v2.1.0(1w ago)110MITPHPPHP ^8.3

Since Dec 29Pushed 1w agoCompare

[ Source](https://github.com/EreborCodeForge/mithrilphp)[ Packagist](https://packagist.org/packages/ereborcodeforge/mithrilphp)[ Docs](https://github.com/EreborCodeForge/mithrilphp)[ RSS](/packages/ereborcodeforge-mithrilphp/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (9)Dependencies (2)Versions (15)Used By (0)

```
 __    __     __     ______   __  __     ______     __     __
/\ "-./  \   /\ \   /\__  _\ /\ \_\ \   /\  == \   /\ \   /\ \
\ \ \-./\ \  \ \ \  \/_/\ \/ \ \  __ \  \ \  __<   \ \ \  \ \ \____
 \ \_\ \ \_\  \ \_\    \ \_\  \ \_\ \_\  \ \_\ \_\  \ \_\  \ \_____\
  \/_/  \/_/   \/_/     \/_/   \/_/\/_/   \/_/ /_/   \/_/   \/_____/ PHP

```

MithrilPHP
==========

[](#mithrilphp)

**MithrilPHP** is a lightweight and resilient PHP engine designed to silently protect applications.
Invisible by design, it provides a solid runtime foundation without imposing architectural decisions.

---

Purpose
-------

[](#purpose)

MithrilPHP exists to be the **engine behind frameworks**, not the framework itself.

It provides the essential building blocks required to execute applications reliably, while remaining lightweight, explicit, and opinion-free.

---

Design Philosophy
-----------------

[](#design-philosophy)

Inspired by the Mithril worn by Frodo, MithrilPHP follows a simple principle:

> **You should not feel it — until it saves you.**

- The core protects execution, not business logic
- The domain remains sovereign
- The engine absorbs impact without dictating structure

---

What MithrilPHP Is
------------------

[](#what-mithrilphp-is)

- A **core runtime engine**
- A foundation for frameworks
- A silent execution layer
- A console and HTTP backbone
- A **warm Worker** path for long-lived processes with a compiled container

---

What MithrilPHP Is Not
----------------------

[](#what-mithrilphp-is-not)

- A full framework
- A project skeleton
- An MVC solution
- A DDD or Clean Architecture implementation

Those responsibilities belong to **frameworks built on top of MithrilPHP**.

---

Core Responsibilities
---------------------

[](#core-responsibilities)

- HTTP Kernel and routing execution
- Console Kernel and command execution
- Dependency Injection container (runtime + compiled)
- Warm Worker loop (boot once, scoped per request)
- Environment variable access
- Configuration loading
- Low-level abstractions required by frameworks

---

Warm Runtime / Worker
---------------------

[](#warm-runtime--worker)

Classic PHP pays boot cost on every request. Mithril’s Worker boots **once**, keeps the compiled container warm, and isolates request state with `beginScope` / `endScope`.

LifetimeUse for**preloaded / singleton**Router, config, logger, connection pools**scoped**Request-bound state (tickets, UoW, auth context)**factory**Throwaway instances**Plug an existing Kernel** (methods you already have):

```
use Erebor\Mithril\Contracts\HttpApplication;
use Erebor\Mithril\Runtime\FpmOnceBridge;
use Erebor\Mithril\Runtime\Worker;

final class Kernel implements HttpApplication
{
    // boot(), handle(Request): Response, getContainer() — already on your app Kernel
}

// public/index.php (FPM / php -S — one request, same Worker path)
$kernel = new Kernel();
(new Worker($kernel, new FpmOnceBridge()))->run();
```

**Multi-request in one process** (tests, custom bridges, future RoadRunner/FrankenPHP adapters):

```
use Erebor\Mithril\Runtime\InMemoryBridge;
use Erebor\Mithril\Runtime\Worker;

$bridge = new InMemoryBridge([$requestA, $requestB]);
(new Worker($kernel, $bridge, maxRequests: 1000))->run();
```

- `FpmOnceBridge` — classic one-shot HTTP
- `InMemoryBridge` — queue of requests for tests/benchmarks
- `EregionBridge` — UDS + MessagePack for the Eregion Application Server (`forge serve`)
- Implement `RequestBridge` for RoadRunner, FrankenPHP, or any transport

`Container::loadCompiled(...)` stores a **warm baseline**; `resetWorker()` clears scoped/lazy instances and restores preloaded services without a full reboot.

Full guide: [docs/runtime-worker.md](docs/runtime-worker.md)

---

Ecosystem
---------

[](#ecosystem)

MithrilPHP is designed to power opinionated frameworks.

The first official implementation is:

- **Durin’s Forge** — a framework that forges real applications on top of MithrilPHP

---

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

[](#installation)

```
composer require ereborcodeforge/mithrilphp
```

---

[![Forge CLI Preview](docs/images/image.png)](docs/images/image.png)

*Forged by EreborCodeForge*

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance98

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Recently: every ~54 days

Total

9

Last Release

13d ago

Major Versions

v0.1.4 → v1.0.02026-01-20

v1.0.1 → v2.0.02026-08-05

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/45312085?v=4)[Thales Ruppenthal](/maintainers/Thalesrup)[@Thalesrup](https://github.com/Thalesrup)

---

Top Contributors

[![Thalesrup](https://avatars.githubusercontent.com/u/45312085?v=4)](https://github.com/Thalesrup "Thalesrup (27 commits)")

---

Tags

httpphpconsoleframeworkroutingenginemithrilerebor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ereborcodeforge-mithrilphp/health.svg)

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

PHPackages © 2026

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