PHPackages                             ridwans2/raja-modular-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. ridwans2/raja-modular-core

ActiveLibrary

ridwans2/raja-modular-core
==========================

A professional, framework-agnostic modular architecture for Laravel 11+. Features zero-config autoloading, 29+ Artisan command overrides, and seamless Vite integration.

v1.1.5(3w ago)12MITPHPPHP ^8.2

Since Jan 24Pushed 1w agoCompare

[ Source](https://github.com/ridwans2/raja-modular-core)[ Packagist](https://packagist.org/packages/ridwans2/raja-modular-core)[ RSS](/packages/ridwans2-raja-modular-core/feed)WikiDiscussions main Synced today

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

Raja Modular Core 🚀
===================

[](#raja-modular-core-)

[![Laravel Modular Banner](art/banner.png)](art/banner.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d2a2f4bf179d3db3d736c0c14442c4eee945b352f5fb23bfc05126d9d50289ec/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696477616e73322f72616a612d6d6f64756c61722d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ridwans2/raja-modular-core)[![GitHub Tests Action Status](https://camo.githubusercontent.com/193e39378bff381df44fe56962d501199dc04cdac651b6222e9e16f53a7702a1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72696477616e73322f72616a612d6d6f64756c61722d636f72652f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ridwans2/raja-modular-core/actions?query=workflow%3ATests+branch%3Amain)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/71d313577e292a6c13d72cd1c0f970164591fbb92ef2811b1243ed199883c609/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72696477616e73322f72616a612d6d6f64756c61722d636f72652f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/ridwans2/raja-modular-core/actions?query=workflow%3APHPStan+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/35e6cc2db2caf04fa3e585a00124ecd5c3c5e5567aefd266d08de3d7936269c8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72696477616e73322f72616a612d6d6f64756c61722d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ridwans2/raja-modular-core)[![Licence](https://camo.githubusercontent.com/e445f25dd7887917bcbd2037a920502acc835c256751a9024e14a8a1d034a7d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72696477616e73322f72616a612d6d6f64756c61722d636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ridwans2/raja-modular-core)

**Raja Modular Core** is a professional, framework-agnostic modular system engineered for Laravel 11/12. It empowers you to build scalable, strictly typed, and decoupled applications with zero configuration overhead.

We override 29+ native Artisan commands to provide a seamless "first-class" modular experience, feeling exactly like standard Laravel but better.

✨ Features
----------

[](#-features)

- 🏗️ **Native Experience**: 29+ Artisan commands (`make:model`, `make:controller`, etc.) fully support `--module`.
- ⚡ **Zero Config Autoloading**: Intelligent `composer-merge-plugin` integration for isolated module dependencies.
- 🚦 **Topological Sorting**: Strict dependency graph resolution ensures base modules always boot before their dependents.
- 🚀 **Performance First**: Built-in discovery caching (`modular:cache`) for near-zero overhead in production.
- 🔄 **Dynamic Activation**: Enable or disable modules on the fly via `module:enable` and `module:disable`.
- 🔍 **Auto-Discovery**: Automatic registration of Artisan commands, Policies, and Event Listeners within modules.
- 🔌 **Decoupled Architecture**: Strictly typed `ModuleRegistry` and traits for maximum stability.
- 🛠️ **Full Customizability**: Override generation stubs globally or specific to a single module via `aplikasi/Shop/stubs`.
- ✅ **Laravel 11 &amp; 12 Ready**: Optimized for PHP 8.2+ and the latest framework features.
- 🎨 **Asset Management**: Seamless Vite integration via `modular_vite()` and asset linking.

---

🌍 Ecosystem
-----------

[](#-ecosystem)

Enhance your modular application with our official packages:

- **[Raja Hooks](https://github.com/ridwans2/raja-hooks)**: specific modular hook system support.
- **[Filament Integration](https://github.com/ridwans2/raja-modular-filament)**: Seamless Filament admin panel integration in modules.
- **[Livewire Integration](https://github.com/ridwans2/raja-modular-livewire)**: First-class Livewire component support in modules.
- **[Raja Themer](https://github.com/ridwans2/raja-themer)**: Advanced theme management system.

---

🚀 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require ridwans2/raja-modular-core
```

Run the installation command to automatically configure your application:

```
php artisan modular:install
```

> **Note**: This will automatically install and configure `wikimedia/composer-merge-plugin` to handle your module dependencies.

### Manual Setup

[](#manual-setup)

If you prefer to configure things manually, follow these steps:

**1. Composer Autoloading**Add the following to your root `composer.json` to ensure module namespaces are autoloaded:

```
"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Aplikasi\\": "aplikasi/"
    }
},
"extra": {
    "merge-plugin": {
        "include": [
            "aplikasi/*/composer.json"
        ]
    }
}
```

**2. Vite Configuration**To enable hot-readling for module assets, create a `vite.modular.js` file in your root and update `vite.config.js`:

```
// vite.config.js
import { defineConfig } from "vite";
import laravel from "laravel-vite-plugin";
import { modularLoader } from "./vite.modular.js";

export default defineConfig({
    plugins: [
        laravel({
            input: [
                "resources/css/app.css",
                "resources/js/app.js",
                ...modularLoader.inputs(), // Add this line
            ],
            refresh: [
                ...modularLoader.refreshPaths(), // Add this line
            ],
        }),
    ],
});
```

---

📖 Usage
-------

[](#-usage)

### Creating a Module

[](#creating-a-module)

Generate a fully structured module in seconds:

```
php artisan make:module Blog
```

### Generating Resources

[](#generating-resources)

Every standard Laravel `make:` command acts as a modular command when you pass the `--module` flag:

```
# Create a Model with Migration, Controller, and Factory in 'Blog' module
php artisan make:model Post --module=Blog -mcf

# Create a resource controller
php artisan make:controller API/PostController --module=Blog --api
```

### Modular Database

[](#modular-database)

Run migrations and seeders specifically for your modules:

```
# Migrate all modules
php artisan modular:migrate

# Migrate a specific module
php artisan modular:migrate Blog --fresh --seed

# Rollback a module's migrations
php artisan modular:migrate Blog --rollback --step=2

# Run module seeders
php artisan modular:seed Blog
```

### Module Management &amp; Utilities

[](#module-management--utilities)

```
# List all modules and discovered resources
php artisan modular:list

# Visualize module dependencies in an ASCII tree
php artisan modular:list --tree

# Diagnose common configuration issues and view Health Scores
php artisan modular:doctor

# Sync module dependencies to root composer.json
php artisan modular:sync

# Export a module to a standalone Composer package
php artisan modular:export Blog --path=packages/blog

# Run npm commands for a module (Workspaces)
php artisan modular:npm Blog install
php artisan modular:npm Blog build

# Check for circular dependencies
php artisan modular:check

# Debug module configuration
php artisan modular:debug Blog

# Run module tests
php artisan modular:test Blog
```

### Blade Directives

[](#blade-directives)

Use our dedicated Blade directives to conditionally render UI based on module availability:

```
@moduleEnabled('Blog')
    Read the Blog
@endmoduleEnabled

@moduleDisabled('Store')
    Our store is currently offline.
@endmoduleDisabled
```

### 🏎️ Performance Optimization

[](#️-performance-optimization)

For maximum production performance, we recommended the following:

1. **Optimized PSR-4**: Ensure `"Aplikasi\\": "aplikasi/"` is in your root `composer.json`. `modular:install` handles this for you.
2. **Dependency Syncing**: Use `php artisan modular:sync` to merge module dependencies into your root `composer.json` and disable the merge-plugin.
3. **Discovery Caching**: Always run `php artisan modular:cache` in your deployment pipeline.

### Middleware &amp; Config

[](#middleware--config)

Define middleware in your `module.json`:

```
"middleware": {
    "web": ["Aplikasi\\Blog\\Http\\Middleware\\TrackVisits"],
    "blog.admin": "Aplikasi\\Blog\\Http\\Middleware\\AdminGuard"
}
```

Access config case-insensitively:

```
// Both work!
config('Blog::settings.key');
config('blog::settings.key');
```

---

🛠️ Helpers &amp; Assets
-----------------------

[](#️-helpers--assets)

### Global Helpers

[](#global-helpers)

Access module information globally with strictly typed helpers:

```
// Get the registry or specific module config
$modules = module();
$blogConfig = module('Blog');

// Get absolute path to a resource
$viewPath = module_path('Blog', 'Resources/views');

// Get absolute path to a config file
$configPath = module_config_path('Blog', 'settings.php');
```

### Asset Management

[](#asset-management)

Link your module assets to `public/modules` for easy serving:

```
php artisan modular:link
```

Use the helper to generate asset URLs in your Blade views:

```

```

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish the configuration file for advanced customization:

```
php artisan vendor:publish --tag="modular-config"
```

You can customize:

- **Paths**: Move modules to `packages/` or any custom directory.
- **Stubs**: Enable custom stubs to strictly enforce your team's coding standards.
- **Composer**: Set default fields (`vendor`, `author`, `license`) for generated `composer.json` files.

---

🧪 Testing
---------

[](#-testing)

We strictly enforce testing. Use the provided test suite to verify your modules:

```
vendor/bin/pest
```

---

🌍 Ecosystem
-----------

[](#-ecosystem-1)

Extend your modular architecture with our official ecosystem packages:

PackageDescription**[Laravel Themer](https://github.com/ridwans2/laravel-themer)**For advanced theme management support**[Modular Livewire](https://github.com/ridwans2/raja-modular-core-livewire)**Provides automatic Livewire component discovery and registration within modules.**[Modular JS](https://github.com/ridwans2/raja-modular-core-js)**Enables JS discovery within modular structures and provides zero-config autoloading for modules.**[Modular Filament](https://github.com/ridwans2/raja-modular-core-filament)**Enables Filament v5 admin panel integration with automatic discovery in modules.**[Filament Themer Launcher](https://github.com/ridwans2/filament-themer-luncher)**Provides a comprehensive Filament v5 interface for managing and switching themes.**[Filament Modular Launcher](https://github.com/ridwans2/filament-modular-luncher)**A powerful Filament v5 manager for listing, toggling, and backing up system modules.**[Laravel Hooks](https://github.com/ridwans2/laravel-hooks)**Adds a universal extensibility and plugin system for Laravel applications.### ⚡ JavaScript &amp; Vite Integration

[](#-javascript--vite-integration)

We provide first-class support for modern frontend tooling:

- **NPM Workspaces**: Run `php artisan modular:npm` to configure workspaces, allowing each module to manage its own `package.json` dependencies efficiently.
- **Vite Integration**: Use the `modular_vite('ModuleName')` helper to load module-specific assets with full Hot Module Replacement (HMR) support.
- **Asset Publishing**: Easily publish public assets to the main application with `php artisan modular:link`.

---

💖 Sponsors
----------

[](#-sponsors)

We would like to extend our thanks to the following sponsors for funding Laravel Modular development. If you are interested in becoming a sponsor, please visit the [Laravel Modular GitHub Sponsors page](https://github.com/sponsors/ridwans2).

---

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

---

🌟 Acknowledgments
-----------------

[](#-acknowledgments)

- **Laravel**: For creating the most elegant PHP framework.
- **Spatie**: For setting the standard on Laravel package development.

---

🔒 Security
----------

[](#-security)

If you discover any security-related issues, please email **Ali Harb** at .

📄 License
---------

[](#-license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

---

 Made with ❤️ by **Ali Harb**

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance97

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~5 days

Total

7

Last Release

21d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/93927f84d28ebd02a8233f8f1d00c9b4a555a4c62dc6fc6b99d69bacd68dd9ff?d=identicon)[ridwans2](/maintainers/ridwans2)

---

Top Contributors

[![AlizHarb](https://avatars.githubusercontent.com/u/34816428?v=4)](https://github.com/AlizHarb "AlizHarb (4 commits)")[![ridwans2](https://avatars.githubusercontent.com/u/54924092?v=4)](https://github.com/ridwans2 "ridwans2 (2 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ridwans2-raja-modular-core/health.svg)

```
[![Health](https://phpackages.com/badges/ridwans2-raja-modular-core/health.svg)](https://phpackages.com/packages/ridwans2-raja-modular-core)
```

###  Alternatives

[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

136.9k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

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