PHPackages                             zkr/nexusphp - 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. zkr/nexusphp

ActiveLibrary

zkr/nexusphp
============

NexusPHP - A standalone, dependency-free PHP 8.2+ framework

v1.0.0(yesterday)22↑2900%MITPHPPHP &gt;=8.2CI passing

Since Aug 23Pushed todayCompare

[ Source](https://github.com/gak722/nexusphp)[ Packagist](https://packagist.org/packages/zkr/nexusphp)[ RSS](/packages/zkr-nexusphp/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (8)Used By (0)

⚡ NexusPHP Framework
====================

[](#-nexusphp-framework)

**NexusPHP** is a zero-dependency, ultra-lightweight **Laravel alternative** built for PHP 8.2+. Engineered specifically for high-concurrency applications, serverless runtimes, edge containers, and resource-constrained environments, NexusPHP delivers the developer ergonomics of Laravel with zero vendor bloat and a micro-footprint.

By eliminating third-party Composer runtime dependencies, NexusPHP runs at **&lt; 3.5ms execution latency** and **&lt; 2.0MB memory footprint**, making it the ultimate lightweight alternative for modern PHP development.

---

🔥 Why NexusPHP? (The Lightweight Laravel Competitor)
----------------------------------------------------

[](#-why-nexusphp-the-lightweight-laravel-competitor)

Feature / MetricStandard Heavy Frameworks (e.g., Laravel)NexusPHP (Lightweight Competitor)**Dependencies**30+ vendor packages (`composer install` required)**Zero third-party dependencies** (Native PHP 8.2+)**Base Memory Allocation**~12.0 MB - 25.0 MB per request**&lt; 2.0 MB** per request**Base Boot Latency**~15.0 ms - 45.0 ms**&lt; 3.5 ms** per request**Skeleton Inode Count**~10,000+ files and directories**&lt; 200 inodes** total skeleton footprint**Security Defaults**Multi-package dependenciesBuilt-in `libsodium` secretbox, Argon2id, PDO prepared SQL, CSRF, and rate limiting---

🎯 Core Principles &amp; Architecture Philosophy
-----------------------------------------------

[](#-core-principles--architecture-philosophy)

NexusPHP synthesizes three battle-tested software engineering paradigms:

1. **🚀 Zero-Dependency Purity &amp; Deterministic Footprint (ASP.NET Core Integrity)**

    - No supply-chain vulnerability risks from nested third-party dependencies.
    - Base skeleton footprint is strictly capped under **200 inodes** with peak memory allocation of **&lt; 2.0 MB** per request.
    - 100% strict type safety (`declare(strict_types=1);`) across the entire framework codebase.
2. **⚡ Predictable Lifecycle &amp; Low Overhead (Express.js Ergonomics)**

    - Pure functional onion middleware pipeline: `fn(Request $request, Closure $next): Response`.
    - Zero dynamic magic methods (`__get`, `__set`) in core HTTP classes.
    - Baseline request dispatch latency strictly under **3.5ms**.
3. **💡 Modern Application Design (Next.js Capabilities)**

    - Intuitive routing ergonomics, grouped prefixes, parameter constraints, and controller dispatchers.
    - Native Server-Sent Events (`SseResponse`) streaming interface for real-time applications.
    - Unified caching and fine-grained output revalidation (`File`, `Redis`, `APCu`).

---

✨ Feature Overview
------------------

[](#-feature-overview)

- **🔒 Enterprise Security Standard:**
    - **SQL Injection:** 100% positional prepared statement parameter binding (`?`) across `QueryBuilder` and `Model`.
    - **CSRF Mitigation:** Synchronizer Token pattern (`Csrf::validate()`) with constant-time string comparisons (`hash_equals()`).
    - **Authenticated Encryption:** Native `libsodium` secretbox encryption (`sodium_crypto_secretbox`).
    - **Password Security:** Native `Argon2id` and `Bcrypt` hashing wrappers.
    - **Authentication:** Stateful cookie sessions and stateless bearer `Jwt` guards.
    - **Rate Limiting:** Sliding-window throttle preventing brute-force attempts.
- **🗃️ ActiveRecord ORM &amp; Database Schema:** Chainable query generator, relationship definitions (`BelongsTo`, `HasMany`, `HasOne`, `BelongsToMany`), programmatic DDL `Blueprint` / `Schema`, and versioned batch `Migrator`.
- **📨 Background Queues &amp; Async Processing:** Background job serialization (`DatabaseQueue`, `RedisQueue`) with dedicated CLI worker loops (`Worker`).
- **📡 Realtime Pub/Sub &amp; SSE Streaming:** Redis Pub/Sub broadcast manager and buffer-flushed Server-Sent Events.
- **🛠️ Nexus CLI Binary (`nexus`):** Standalone terminal tooling for database migrations, background queues, development server, and code generators (`make:controller`, `make:model`, `make:migration`).

---

🚀 Quick Start Guide
-------------------

[](#-quick-start-guide)

### 1. Boot Local Development Server

[](#1-boot-local-development-server)

Launch the development server using the executable `nexus` binary:

```
php nexus serve
```

Open `http://127.0.0.1:8000` in your browser.

### 2. Route Definition (`routes/web.php`)

[](#2-route-definition-routeswebphp)

```
