PHPackages                             power-modules/router - 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. power-modules/router

ActiveLibrary[Framework](/categories/framework)

power-modules/router
====================

A modular router component for the Power Modules framework with encapsulated routing capabilities and explicit module integration

v1.2.1(7mo ago)263↓62.5%MITPHPPHP ^8.4CI passing

Since Sep 20Pushed 1mo agoCompare

[ Source](https://github.com/power-modules/router)[ Packagist](https://packagist.org/packages/power-modules/router)[ RSS](/packages/power-modules-router/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (6)Versions (7)Used By (0)

Modular Router
==============

[](#modular-router)

[![CI](https://github.com/power-modules/router/actions/workflows/php.yml/badge.svg)](https://github.com/power-modules/router/actions/workflows/php.yml)[![Packagist Version](https://camo.githubusercontent.com/363c06ffa79f44d28073f52ccf823d044e830d900758d1f9cb960741de562255/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706f7765722d6d6f64756c65732f726f75746572)](https://packagist.org/packages/power-modules/router)[![PHP Version](https://camo.githubusercontent.com/39f4130e59c7dff6cc7291b28fa992fa4e9ff835368aba7b0337f7730584fe64/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f706f7765722d6d6f64756c65732f726f75746572)](https://packagist.org/packages/power-modules/router)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)[![PHPStan](https://camo.githubusercontent.com/1b02b2f6c2946c9b9ad2e14b1c79c5932fdcef4ea31b4d6e79d54af7d7e7a2a7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d626c7565)](#)

A **modular router component** for the Power Modules framework that provides HTTP routing capabilities with strict module encapsulation, dependency injection integration, and RFC 7807 problem-details defaults for router-owned errors.

> **🔌 Perfect Integration**: Built specifically for the Power Modules ecosystem with automatic route discovery, module-scoped controllers, and composable middleware stacks.

✨ Why Modular Router?
---------------------

[](#-why-modular-router)

- **🏗️ Module-Centric**: Routes are owned and defined by individual modules
- **🔒 Encapsulated Controllers**: Controllers resolve from their originating module's DI container
- **🎯 Auto-Prefixing**: Module names automatically become URL prefixes (`UserModule` → `/user/*`)
- **🧩 Composable Middleware**: Module-level and route-level middleware stacking
- **⚡ Zero Configuration**: Automatic route discovery with convention-based patterns
- **📄 RFC 7807 By Default**: Router-owned errors and default unhandled exceptions emit `application/problem+json`
- **🛡️ Type-Safe**: Full PHP 8.4+ type system integration with enums and strict typing

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

[](#quick-start)

```
composer require power-modules/router
```

```
