PHPackages                             monkeyscloud/monkeyslegion-core - 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. monkeyscloud/monkeyslegion-core

ActiveLibrary[Framework](/categories/framework)

monkeyscloud/monkeyslegion-core
===============================

High-performance framework kernel with typed config, service providers, pipeline, and PHP 8.4 primitives for the MonkeysLegion framework.

2.0.3(2mo ago)12.5k↓11.3%16MITPHPPHP ^8.4

Since Jul 23Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/MonkeysCloud/MonkeysLegion-Core)[ Packagist](https://packagist.org/packages/monkeyscloud/monkeyslegion-core)[ RSS](/packages/monkeyscloud-monkeyslegion-core/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (1)Dependencies (27)Versions (18)Used By (16)

MonkeysLegion Core v2
=====================

[](#monkeyslegion-core-v2)

High-performance framework kernel with typed config, service providers, pipeline, and PHP 8.4 primitives for the MonkeysLegion framework.

Features
--------

[](#features)

FeatureStatus**PHP 8.4 Native**Property hooks, backed enums, `readonly` classes, `new` in initializers**3 Attributes**`#[Provider]`, `#[BootAfter]`, `#[Config]`**Application Kernel**Provider registration, topological boot ordering, lifecycle hooks**Generic Pipeline**Immutable, zero-reflection, multi-pipe-type support**Exception Handler**Environment-aware: full debug local, sanitized in production**Error Rendering**Error Renderer contract + implementation for CLI/debug output**Typed Config**Dot-notation, O(1) cached lookups, type-safe getters**Arr Utilities**dot/undot, flatten, pluck, groupBy, sortBy, first/last**Str Utilities**camel/snake/kebab/studly, slug, UUID/ULID, mask, random (CSPRNG)**Benchmark**hrtime precision, memory measurement, comparison**Once (Memoization)**Rust-inspired call-once with keyed caching**PSR-20 Clock**Testable system clock**20+ Helper Functions**env, paths, retry, rescue, tap, value, blank/filledRequirements
------------

[](#requirements)

- **PHP 8.4** or higher
- `psr/container` ^2.0
- `psr/log` ^3.0
- `psr/clock` ^1.0

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

[](#installation)

```
composer require monkeyscloud/monkeyslegion-core:dev-2.0.0
```

Architecture
------------

[](#architecture)

```
src/
├── Attribute/          # #[Provider], #[BootAfter], #[Config]
├── Clock/              # PSR-20 SystemClock
├── Config/             # Typed ConfigRepository with dot-notation
├── Contract/           # Bootable, Deferrable, ExceptionRendererInterface
├── Environment/        # Backed enum + detector
├── Error/              # Error renderers (interface + plain-text renderer)
├── Exception/          # Handler + HttpException with factories
├── Kernel/             # Application kernel with lifecycle hooks
├── Pipeline/           # Generic pipeline (Laravel parity)
├── Provider/           # ServiceProviderInterface + AbstractProvider
└── Support/            # Arr, Str, Benchmark, Once, helpers.php

```

Quick Start
-----------

[](#quick-start)

### Kernel Boot

[](#kernel-boot)

```
use MonkeysLegion\Core\Kernel\Kernel;
use MonkeysLegion\Core\Environment\Environment;

$kernel = new Kernel(
    container: $container,
    environment: Environment::Production,
);

$kernel->register(new DatabaseProvider());
$kernel->register(new AuthProvider());
$kernel->boot();

// ... handle request ...

$kernel->terminate();
```

### Service Providers

[](#service-providers)

```
use MonkeysLegion\Core\Attribute\Provider;
use MonkeysLegion\Core\Attribute\BootAfter;
use MonkeysLegion\Core\Contract\Bootable;
use MonkeysLegion\Core\Provider\AbstractProvider;

#[Provider(priority: 10)]
#[BootAfter(DatabaseProvider::class)]
final class AuthProvider extends AbstractProvider implements Bootable
{
    public function register(): void
    {
        // Register bindings
    }

    public function boot(): void
    {
        // Boot after DatabaseProvider
    }
}
```

### Pipeline

[](#pipeline)

```
use MonkeysLegion\Core\Pipeline\Pipeline;

$result = (new Pipeline())
    ->send($request)
    ->through([
        TrimStrings::class,
        ValidateInput::class,
        AuthenticateUser::class,
    ])
    ->then(fn($req) => $handler->handle($req));
```

### Config

[](#config)

```
use MonkeysLegion\Core\Config\ConfigRepository;

$config = new ConfigRepository([
    'database' => [
        'host' => 'localhost',
        'port' => 5432,
    ],
]);

$host = $config->string('database.host');       // 'localhost'
$port = $config->int('database.port');           // 5432
$ssl  = $config->bool('database.ssl', false);    // false
```

### Exception Handling

[](#exception-handling)

```
use MonkeysLegion\Core\Exception\Handler;
use MonkeysLegion\Core\Exception\HttpException;

// In production: generic messages, no stack traces
$handler = new Handler(Environment::Production, $logger);

try {
    throw HttpException::notFound('User not found');
} catch (\Throwable $e) {
    $handler->report($e);
    $response = $handler->render($e);
    // { error: true, status: 404, message: "User not found" }
}
```

### Utilities

[](#utilities)

```
use MonkeysLegion\Core\Support\{Arr, Str, Benchmark, Once};

// Arrays
Arr::get($data, 'user.address.city', 'Unknown');
Arr::dot(['a' => ['b' => 1]]);  // ['a.b' => 1]

// Strings
Str::uuid();                    // 'f47ac10b-58cc-...'
Str::slug('Hello World!');      // 'hello-world'
Str::mask('secret123', '*', 3); // 'sec******'
Str::random(32);                // CSPRNG-backed

// Benchmark
$ms = Benchmark::measure(fn() => expensiveQuery(), iterations: 100);

// Memoization
$value = Once::callKeyed('config', fn() => loadConfig());
```

Performance &amp; Security
--------------------------

[](#performance--security)

### Performance

[](#performance)

- **ConfigRepository**: O(1) cached dot-notation lookups after first access
- **Pipeline**: Zero reflection, no container resolution overhead
- **Kernel**: Topological sort (Kahn's algorithm) runs once during boot
- **Benchmark**: hrtime() for nanosecond precision
- **Arr/Str**: Static methods with zero state, minimal allocations

### Security

[](#security)

- **Exception Handler**: Never exposes stack traces, file paths, or internal details in production
- **Str::random()**: CSPRNG-backed via random\_int()
- **Str::uuid()/ulid()**: CSPRNG-backed via random\_bytes()
- **env()**: Only reads from server environment, never from user input
- **HttpException**: Client-safe messages; internal details via $previous
- **Kernel::terminate()**: Catches all exceptions to prevent information leaks
- **Str::mask()**: Safely hides sensitive data (tokens, API keys)

Testing
-------

[](#testing)

```
vendor/bin/phpunit --testdox
```

**114 tests, 238 assertions** — 100% passing.

License
-------

[](#license)

MIT License. See LICENSE file for details.

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance87

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 54.1% 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 ~21 days

Recently: every ~4 days

Total

14

Last Release

66d ago

Major Versions

1.0.8 → 2.0.0.x-dev2026-04-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2913369?v=4)[Jorge Peraza](/maintainers/yorchperaza)[@yorchperaza](https://github.com/yorchperaza)

---

Top Contributors

[![yorchperaza](https://avatars.githubusercontent.com/u/2913369?v=4)](https://github.com/yorchperaza "yorchperaza (20 commits)")[![Amanar-Marouane](https://avatars.githubusercontent.com/u/155680356?v=4)](https://github.com/Amanar-Marouane "Amanar-Marouane (13 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (4 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/monkeyscloud-monkeyslegion-core/health.svg)

```
[![Health](https://phpackages.com/badges/monkeyscloud-monkeyslegion-core/health.svg)](https://phpackages.com/packages/monkeyscloud-monkeyslegion-core)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[typo3/cms-core

TYPO3 CMS Core

3713.2M5.1k](/packages/typo3-cms-core)

PHPackages © 2026

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