PHPackages                             kodepandai/laravel-modular - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kodepandai/laravel-modular

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kodepandai/laravel-modular
==========================

320[1 issues](https://github.com/kodepandai/laravel-modular/issues)PHP

Since Jun 8Pushed 2y ago2 watchersCompare

[ Source](https://github.com/kodepandai/laravel-modular)[ Packagist](https://packagist.org/packages/kodepandai/laravel-modular)[ RSS](/packages/kodepandai-laravel-modular/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel Modular
===============

[](#laravel-modular)

> THIS BRANCH IS WIP! TODO: Improve documentation

Modularize your laravel app in a package way. Inspired by [`spatie/laravel-package-tools`](https://github.com/spatie/laravel-package-tools).

This laravel modular package is built with the concept that each module is considered as a separate package. So it will allow you to structure the module folders in the same way as you build a laravel package.

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

[](#installation)

```
$ composer require kodepandai/laravel-modular
```

After installation, add this configuration to your `composer.json`

```
"repositories": [
  // ...
  {
    "type": "path",
    "url": "modules/*/",
    "options": {
      "symlink": true
    }
  }
  // ...
],
```

Usage
-----

[](#usage)

### New Module

[](#new-module)

```
$ php artisan modular:make Sales
```

\*Sales is the module name

### Working with Modular

[](#working-with-modular)

This package *DOES NOT* load resources (routes, config, migration, etc) automatically, instead you need to manually load them in your module `ServiceProvider`.

### Module Service Provider

[](#module-service-provider)

```
namespace Sales\Providers;

use KodePandai\Modular\Module;
use KodePandai\Modular\Providers\ModuleServiceProvider;

class SalesServiceProvider extends ModuleServiceProvider
{
    public function configureModule(Module $module): void
    {
        $module->name('Sales')
               ->hasViews()
               ->hasMigrations()
               ->hasRoutes();

        // $module->hasOtherThings() ...
    }
}
```

### Configs

[](#configs)

Put your config file in the `/config` folder, then register it with:

```
// load all configs
$module->hasConfigs();

// load one config
$module->hasConfig('sales');

// load multiple configs
$module->hasConfigs(['sales', 'services']);
```

### Views

[](#views)

Put your view file in the `/resources/views` folder, then register it with:

```
// load all views
$module->hasViews();
```

### View Components

[](#view-components)

Put your view component file in the `/src/Components` folder, then register it with:

```
// load one  component
$module->hasViewComponent('sales', \Sales\Components\Header::class);

// load multiple components
$module->hasViewComponents('sales', [
  \Sales\Components\Header::class, //
  \Sales\Components\Sidebar::class, //
]);
```

### Translations

[](#translations)

Put your translation file in the `/lang`or `/resources/lang` folder, then register it with:

```
$module->hasTranslations();
```

### Migrations

[](#migrations)

Put your migration in the `/database/migrations` folder, then register it with:

```
// load all migrations
$module->hasMigrations();
```

Note:

- For factory put in the `/database/factories` folder
- For seeder put in the `/database/seeders` folder

### Routes

[](#routes)

Put your route file in the `/routes` folder, then register it with:

```
// load all routes
$module->hasRoutes();

// load one route
$module->hasRoute('web');

// load multiple routes
$module->hasRoutes(['web', 'api']);
```

### Commands

[](#commands)

Put your command file in the `/src/Commands` folder, then register it with:

```
// load all commands
$module->hasCommmands();

// load one command
$module->hasCommand(\Sales\Commands\CheckServer::class);

// load multiple commands
$module->hasCommands([
  \Sales\Commands\CheckVersion::class,
  \Sales\Commands\CheckServer::class,
]);
```

### Helpers

[](#helpers)

Put your helper function in the `/src/helpers.php` file, then register it with:

```
// load helper
$module->hasHelper();
```

### Middlewares

[](#middlewares)

Put your middleware file int the `/src/Http/Middleware/` folder, then register it with:

```
// load one middleware
$module->hasMiddleware('sales.admin', \Sales\Http\Middleware\EnsureAdminHaveAccessToSales::class);

// load multiple middlewares
$module->hasMiddlewares([
  'sales.admin' => \Sales\Http\Middleware\EnsureAdminHaveAccessToSales::class,
  'sales.whitelist' => \Sales\Http\Middleware\OnlyWhitelistIpCanAccessSales::class,
]);
```

### Service Providers

[](#service-providers)

Put your service provider in the `/src/Providers` folder then register it with:

```
// load one service Provider
$module->hasServiceProvider(\Sales\Providers\PaymentServiceProvider::class);

// load multiple service providers
$module->hasServiceProviders([
  \Sales\Providers\PaymentServiceProvider::class,
  \Sales\Providers\EventServiceProvider::class,
]);
```

Develop
-------

[](#develop)

Run `composer test` to test.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 Bus Factor1

Top contributor holds 75% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/58328fa344fd0959aaf080fa3c82759eae15270ac62c25a64ddc23f65f66edce?d=identicon)[lakuapik](/maintainers/lakuapik)

![](https://www.gravatar.com/avatar/8a66a3f67ded4e30bdd4b715c22827d60bf2d27c1f26979b5eb9cda8f0a9ddd6?d=identicon)[sangvictim](/maintainers/sangvictim)

![](https://www.gravatar.com/avatar/4f3970472c21f6317975c19beec9854cc8f6f1543e13c43c82ef8aa307f42f83?d=identicon)[axmad386](/maintainers/axmad386)

---

Top Contributors

[![lakuapik](https://avatars.githubusercontent.com/u/20186786?v=4)](https://github.com/lakuapik "lakuapik (3 commits)")[![axmad386](https://avatars.githubusercontent.com/u/8775678?v=4)](https://github.com/axmad386 "axmad386 (1 commits)")

---

Tags

laravellaravel-modularlaravel-packagephp

### Embed Badge

![Health badge](/badges/kodepandai-laravel-modular/health.svg)

```
[![Health](https://phpackages.com/badges/kodepandai-laravel-modular/health.svg)](https://phpackages.com/packages/kodepandai-laravel-modular)
```

PHPackages © 2026

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