PHPackages                             kz370/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. [Framework](/categories/framework)
4. /
5. kz370/laravel-modular

ActiveLibrary[Framework](/categories/framework)

kz370/laravel-modular
=====================

A Laravel package for modular architecture with Filament v4 support, pattern inference, and reusable module generation

v1.0.0(4mo ago)013MITPHPPHP ^8.2

Since Jan 6Pushed 4mo agoCompare

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

READMEChangelogDependencies (6)Versions (2)Used By (0)

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

[](#laravel-modular)

A Laravel package for modular architecture with optional Filament v4 support, pattern inference, and reusable module generation.

[![Latest Version on Packagist](https://camo.githubusercontent.com/08dcd57b0f8ab5fba1707eeacc8461fe0b754e4be3d7bb70b92ac7b3df2ce140/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b7a3337302f6c61726176656c2d6d6f64756c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kz370/laravel-modular)[![License](https://camo.githubusercontent.com/570d147771e394f912c9cce66d6db1f7e066619f5cf013e21e49441975f923cf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b7a3337302f6c61726176656c2d6d6f64756c61722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kz370/laravel-modular)

Features
--------

[](#features)

- 🧩 **Modular Architecture** - Build reusable, self-contained modules
- 🔍 **Pattern Inference** - Automatically detects your project patterns
- ⚡ **Filament v4 Support** - Optional Filament resource generation
- 🌐 **Multi-language** - Auto-generates translation files for your locales
- 🔄 **Module Renaming** - Safely rename modules with full reference updates
- ⚙️ **Highly Configurable** - Customize everything via config file
- 📦 **Works with nwidart/laravel-modules** - Extends the popular module package

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

[](#requirements)

- PHP 8.2+
- Laravel 11.x or 12.x
- nwidart/laravel-modules 11.x or 12.x
- (Optional) Filament 3.x for Filament resource generation

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

[](#installation)

```
composer require kz370/laravel-modular
```

The package auto-discovers, so no manual provider registration is needed.

### Publish Configuration

[](#publish-configuration)

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

### Publish Stubs (Optional)

[](#publish-stubs-optional)

To customize the generated file templates:

```
php artisan vendor:publish --tag=laravel-modular-stubs
```

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

[](#quick-start)

### Create a Module

[](#create-a-module)

```
# Basic module
php artisan modular:make Blog

# With Filament resources (if Filament is installed)
php artisan modular:make Blog --with-filament

# Preview what would be created
php artisan modular:make Blog --dry-run
```

### List Modules

[](#list-modules)

```
php artisan modular:list

# Filter by status
php artisan modular:list --status=enabled
```

### Rename a Module

[](#rename-a-module)

```
# Rename with confirmation
php artisan modular:rename Blog Articles

# Preview changes first
php artisan modular:rename Blog Articles --dry-run

# Skip confirmation
php artisan modular:rename Blog Articles --force
```

Configuration
-------------

[](#configuration)

After publishing the config, customize `config/laravel-modular.php`:

### Auto-Detection

[](#auto-detection)

```
// Enable/disable pattern auto-detection
'auto_detect_patterns' => true,
```

### Filament Configuration

[](#filament-configuration)

```
'filament' => [
    'enabled' => true,
    'layout' => 'nested',           // 'nested' or 'flat'
    'generate_form_schemas' => true,
    'generate_table_classes' => true,
    'subdirectories' => ['Pages', 'Schemas', 'Tables'],
    'default_icon' => 'heroicon-o-rectangle-stack',
],
```

### Module Structure

[](#module-structure)

Define which directories to generate:

```
'structure' => [
    'app/Models' => true,
    'app/Policies' => true,
    'app/Filament/Resources' => true,
    'database/migrations' => true,
    'database/seeders' => true,
    'lang' => true,
    // ... more options
],

// Add custom directories
'custom_directories' => [
    'app/Domain/ValueObjects' => true,
    'app/Domain/Enums' => true,
],
```

### Locales

[](#locales)

```
// Auto-detect from project, or specify manually
'locales' => null, // or ['en', 'ar', 'es']
```

### Model Options

[](#model-options)

```
'models' => [
    'use_translatable' => true,  // Spatie Translatable support
    'use_soft_deletes' => false,
    'use_uuids' => false,
],
```

### Policy Options

[](#policy-options)

```
'policies' => [
    'base_class' => 'App\\Policies\\BasePolicy', // or null
    'auto_register' => true,
],
```

Filament Integration
--------------------

[](#filament-integration)

If Filament is installed, the package generates resources that follow your project's patterns:

1. Create a module with Filament resources:

    ```
    php artisan modular:make Products --with-filament
    ```
2. Register in your Panel Provider:

    ```
    use Modules\Products\Providers\ProductsServiceProvider;

    public function panel(Panel $panel): Panel
    {
        return $panel
            // ... other config
            ->discoverResources(
                in: module_path('Products', 'app/Filament/Resources'),
                for: 'Modules\\Products\\Filament\\Resources'
            );

        // Or use the helper method:
        // ProductsServiceProvider::registerFilament($panel);
    }
    ```

Generated Structure
-------------------

[](#generated-structure)

A module created with `--with-filament` will have this structure:

```
Modules/
└── Products/
    ├── app/
    │   ├── Filament/
    │   │   └── Resources/
    │   │       └── ProductResource/
    │   │           ├── ProductResource.php
    │   │           ├── Pages/
    │   │           │   ├── CreateProduct.php
    │   │           │   ├── EditProduct.php
    │   │           │   └── ListProducts.php
    │   │           ├── Schemas/
    │   │           │   └── ProductForm.php
    │   │           └── Tables/
    │   │               └── ProductTable.php
    │   ├── Models/
    │   ├── Policies/
    │   ├── Providers/
    │   │   ├── ProductsServiceProvider.php
    │   │   └── RouteServiceProvider.php
    │   └── Http/
    │       └── Controllers/
    ├── config/
    │   └── config.php
    ├── database/
    │   ├── factories/
    │   ├── migrations/
    │   └── seeders/
    ├── lang/
    │   ├── en/
    │   │   └── products.php
    │   └── ar/
    │       └── products.php
    ├── routes/
    │   ├── api.php
    │   └── web.php
    └── composer.json

```

Commands
--------

[](#commands)

CommandDescription`modular:make {name}`Create a new module`modular:rename {old} {new}`Rename an existing module`modular:list`List all modules### modular:make Options

[](#modularmake-options)

OptionDescription`--with-filament`Generate Filament resources`--plain`Create minimal module structure`--force`Overwrite existing module`--dry-run`Preview without creating### modular:rename Options

[](#modularrename-options)

OptionDescription`--dry-run`Preview changes`--force`Skip confirmation`--no-backup`Skip backup creationWorking with nwidart/laravel-modules
------------------------------------

[](#working-with-nwidartlaravel-modules)

This package works alongside nwidart/laravel-modules. You can still use all their commands:

```
# Enable/disable modules
php artisan module:enable Products
php artisan module:disable Products

# Run migrations
php artisan module:migrate Products

# Generate components
php artisan module:make-model Product Products
php artisan module:make-controller ProductController Products
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for recent changes.

Contributing
------------

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [KZ370](https://github.com/kz370)
- [nwidart/laravel-modules](https://github.com/nWidart/laravel-modules)
- [Filament](https://filamentphp.com)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance77

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

125d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a83ad798b7fe8683b4388105008c4cf18937268bf490bc8379528d362cfc5117?d=identicon)[khaledz370](/maintainers/khaledz370)

---

Top Contributors

[![kz370](https://avatars.githubusercontent.com/u/94254886?v=4)](https://github.com/kz370 "kz370 (5 commits)")

---

Tags

laravelarchitecturemodulesnwidartmodularfilament

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M599](/packages/laravel-ui)[laravel/breeze

Minimal Laravel authentication scaffolding with Blade and Tailwind.

3.0k31.3M148](/packages/laravel-breeze)[laravel/wayfinder

Generate TypeScript representations of your Laravel actions and routes.

1.7k4.1M69](/packages/laravel-wayfinder)[internachi/modular

Modularize your Laravel apps

1.1k662.4k8](/packages/internachi-modular)[laravel/ai

The official AI SDK for Laravel.

732506.3k60](/packages/laravel-ai)[laravel/folio

Page based routing for Laravel.

608453.9k27](/packages/laravel-folio)

PHPackages © 2026

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