PHPackages                             memran/marwa-module - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. memran/marwa-module

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

memran/marwa-module
===================

Framework-agnostic, PSR-11 friendly module management library for PHP apps (Marwa ecosystem compatible).

v1.0.2(1mo ago)09431MITPHPPHP &gt;=8.2CI passing

Since Mar 30Pushed 1mo agoCompare

[ Source](https://github.com/memran/marwa-module)[ Packagist](https://packagist.org/packages/memran/marwa-module)[ RSS](/packages/memran-marwa-module/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (12)Versions (4)Used By (1)

Marwa Module
============

[](#marwa-module)

[![PHP Version](https://camo.githubusercontent.com/9f821e243d9753a1142c21c51472542c300343e1fb9bd8058c6c12644a40f017/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382e322d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/9f821e243d9753a1142c21c51472542c300343e1fb9bd8058c6c12644a40f017/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344253230382e322d626c75653f7374796c653d666c61742d737175617265)[![CI](https://camo.githubusercontent.com/ad9158171c6cef3a3a7d535f28c245640848340350d3947e310754ae71069818/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d656d72616e2f6d617277612d6d6f64756c652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/ad9158171c6cef3a3a7d535f28c245640848340350d3947e310754ae71069818/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d656d72616e2f6d617277612d6d6f64756c652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349267374796c653d666c61742d737175617265)[![Packagist Version](https://camo.githubusercontent.com/833dae5dcfe5a65beb7a3a5886e0a4f8f5ab37a65a436744d89b2444c0ce92e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d656d72616e2f6d617277612d6d6f64756c653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/833dae5dcfe5a65beb7a3a5886e0a4f8f5ab37a65a436744d89b2444c0ce92e6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d656d72616e2f6d617277612d6d6f64756c653f7374796c653d666c61742d737175617265)[![PHPStan](https://camo.githubusercontent.com/a2913bbf90de520d5af638dc490d8f260e1a7c6a122168866a61a4604c844d08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/a2913bbf90de520d5af638dc490d8f260e1a7c6a122168866a61a4604c844d08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e3f7374796c653d666c61742d737175617265)[![Downloads](https://camo.githubusercontent.com/2aa6689c021db13c1604819ac364ea0e7a581ed9143eb405de9806c95d42ec17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d656d72616e2f6d617277612d6d6f64756c653f636f6c6f723d627269676874677265656e267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/2aa6689c021db13c1604819ac364ea0e7a581ed9143eb405de9806c95d42ec17/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d656d72616e2f6d617277612d6d6f64756c653f636f6c6f723d627269676874677265656e267374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/28b92ce3d7f2d6984cabfabc120bcc3fda2fcccc9bd6b7fbed24902bb7fef3f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c69676874677265793f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/28b92ce3d7f2d6984cabfabc120bcc3fda2fcccc9bd6b7fbed24902bb7fef3f9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d6c69676874677265793f7374796c653d666c61742d737175617265)

A framework-agnostic PHP package for discovering, validating, and bootstrapping application modules from the filesystem.

`marwa-module` helps you organize large applications into self-contained modules with their own manifests, routes, resources, migrations, and service providers. It gives you a predictable discovery process, typed lookup APIs, optional caching, and a simple way to register module providers into a PSR-11-friendly application bootstrap.

Features
--------

[](#features)

- Discover modules from one or more directories with deterministic scan order
- Support both `manifest.php` and `manifest.json` module definitions
- Enforce required manifest structure with fail-fast validation and duplicate slug protection
- Preserve custom manifest keys (e.g. `menu`, `permissions`) alongside validated fields
- Access arbitrary manifest values via `$module->get('key', $default)`
- Serialize modules directly with `json_encode($module)` — implements `JsonSerializable`
- Expose clean typed APIs through `Module`, `ModuleHandle`, `ModuleRegistry` (implements `Countable`), and `ModuleBuilder`
- Resolve routes, views, migrations, and other manifest-defined paths relative to the module root
- Prevent unsafe absolute-path and `..` traversal escapes when resolving module paths
- Cache discovered module metadata to a PHP file for faster repeated boots
- Register module service providers through `ModulesServiceProvider`
- Ship with PHPUnit, PHPStan, PHP-CS-Fixer, and GitHub Actions support for development workflows

Requirements
------------

[](#requirements)

- PHP 8.2+
- Composer
- A PSR-11-compatible container if you use `ModulesServiceProvider`

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

[](#installation)

```
composer require memran/marwa-module
```

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

[](#quick-start)

```
