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

ActiveLibrary[Framework](/categories/framework)

laravel-mod/core
================

Lite modular package for Laravel

v1.1.12(8mo ago)012MITPHPPHP ^8.1|^8.2|^8.3|^8.4CI passing

Since Sep 20Pushed 8mo agoCompare

[ Source](https://github.com/Luthfiahmad12/laravel-mod)[ Packagist](https://packagist.org/packages/laravel-mod/core)[ Docs](https://github.com/Luthfiahmad12/laravel-mod)[ GitHub Sponsors](https://github.com/sponsors/Luthfiahmad12)[ RSS](/packages/laravel-mod-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (15)Used By (0)

Laravel Mod
===========

[](#laravel-mod)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8fb1db9e42426366917796f7cf75d75141c2ad147ad69d49fd4d1df2e2989954/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6d6f642f636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-mod/core)[![Tests](https://github.com/Luthfiahmad12/laravel-mod/actions/workflows/tests.yml/badge.svg)](https://github.com/Luthfiahmad12/laravel-mod/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/2e14b64a4a81861d474af0efbd6a6cb2e2f26bb77ee608f1662833aa8884e9c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6d6f642f636f72652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-mod/core)

A **lite modular package** for Laravel that helps you organize your application into clean, maintainable modules without the complexity of large modular systems.

Perfect for small to medium projects that still want maintainable code.

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

[](#-features)

- Generate modules with a single command
- Generate entities within existing modules
- Delete modules and entities
- Cache module information for better performance
- Auto-discovery support - no manual registration required
- Provides common structure out of the box:
    - Controllers
    - Models
    - Requests
    - Services
    - Providers
    - Routes
    - Views
    - Livewire components (for web modules)
    - Migrations
- API module generation with `--api` flag
- Auto-replaces namespace &amp; module naming

🔧 Installation
--------------

[](#-installation)

```
composer require laravel-mod/core
```

### Requirements

[](#requirements)

- **PHP**: 8.1 or higher
- **Laravel**: 11 or higher

> Note: This package uses Laravel's auto-discovery feature and will be automatically registered after installation.

🚀 Quick Start
-------------

[](#-quick-start)

### Generate a new web module

[](#generate-a-new-web-module)

```
php artisan mod:make Blog
```

### Generate a new API module

[](#generate-a-new-api-module)

First, install an API authentication package:

```
# For Laravel Sanctum (recommended)
php artisan install:api

# OR for Laravel Passport
php artisan install:api --passport
```

Then generate the API module:

```
php artisan mod:make Blog --api
```

### Generate a new entity within an existing module

[](#generate-a-new-entity-within-an-existing-module)

For web modules:

```
php artisan mod:make-entity Blog Post
```

For API modules:

```
php artisan mod:make-entity Blog Post --api
```

### Delete a module

[](#delete-a-module)

```
php artisan mod:delete-module Blog
```

### Delete an entity from a module

[](#delete-an-entity-from-a-module)

```
php artisan mod:delete-entity Blog Post
```

### Manage module caches

[](#manage-module-caches)

```
# Cache module information for better performance
php artisan mod:cache

# Clear module caches
php artisan mod:cache --clear
```

🧪 Testing
---------

[](#-testing)

```
composer test
```

Or with coverage:

```
composer test-coverage
```

📁 Module Structure
------------------

[](#-module-structure)

### Web Module

[](#web-module)

```
modules/
└── ModuleName/
    ├── Http/
    │   ├── Controllers/
    │   └── Requests/
    ├── Models/
    ├── Services/
    ├── Providers/
    │   └── ModuleNameServiceProvider.php
    ├── Routes/
    │   └── web.php
    ├── Views/
    ├── Migrations/
    └── Livewire/ (if installed)

```

### API Module

[](#api-module)

```
modules/
└── ModuleName/
    ├── Http/
    │   ├── Controllers/
    │   │   └── Api/
    │   └── Requests/
    ├── Models/
    ├── Services/
    ├── Providers/
    │   └── ModuleNameServiceProvider.php
    ├── Routes/
    │   ├── web.php
    │   └── api.php
    ├── Views/
    └── Migrations/

```

🛠 Module Components
-------------------

[](#-module-components)

### Generated Components

[](#generated-components)

When you create a module, the following components are automatically generated:

1. **Controller** - With a single `index()` method that returns a view
2. **Model** - With `$table` property pre-configured
3. **Request** - Empty form request for validation
4. **Service** - Empty service class with placeholder comment
5. **Service Provider** - For registering module-specific services
6. **Routes** - Single route file with `index` route only:
    - Web routes: `web.php`
    - API routes: `api.php`
7. **Views** - Single `index.blade.php` view file
8. **Migrations** - Standard Laravel migration file

### Route Naming

[](#route-naming)

All routes follow a consistent naming pattern:

- Web routes: `web.php`
- API routes: `api.php`
- Route names: `entity.index` (e.g., `post.index`)

🛠 API Module Features
---------------------

[](#-api-module-features)

When generating an API module with the `--api` flag, you get:

- **Minimal API Controller** with only `index()` method
- **API Routes** with proper middleware applied
- **API Controllers** located in `Http/Controllers/Api/` namespace
- **No web-specific components** (Livewire components)
- **Optimized structure** for API-focused development

The generated API controller includes only the standard `index()` method:

- `index()` - Get a collection of resources

Route files are named simply as `web.php` and `api.php` for better organization.

🛠 Module Service Provider
-------------------------

[](#-module-service-provider)

Each module includes a service provider (`ModuleNameServiceProvider`) that can be used to register module-specific services, bindings, and bootstrapping logic.

**Note:** Routes, views, and migrations are automatically loaded by the main LaravelMod package service provider. The module service provider should only be used for:

- Registering service bindings and singletons
- Registering blade directives
- Registering middleware
- Other module-specific bootstrapping logic

Example usage in `Providers/ModuleNameServiceProvider.php`:

```
public function register(): void
{
    // Register module services
    $this->app->bind(
        \App\Modules\Blog\Services\PostServiceInterface::class,
        \App\Modules\Blog\Services\PostService::class
    );
}

public function boot(): void
{
    // Register blade directives
    Blade::directive('blog', function ($expression) {
        return "";
    });
}
```

📝 Notes
-------

[](#-notes)

- API modules require either Laravel Sanctum or Passport for authentication
- Laravel Sanctum is recommended for most API applications
- All modules are automatically registered with Laravel's service container
- Entity generation automatically detects module type (web or API)
- Livewire components are automatically discovered and registered if Livewire is installed
- Route files are named dynamically for better organization
- Middleware is applied automatically by the service provider
- Package follows "less is more" philosophy - extend as needed

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

[](#-contributing)

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

📄 License
---------

[](#-license)

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

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance62

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~0 days

Total

14

Last Release

240d ago

PHP version history (2 changes)v1.0.0PHP ^8.2

v1.1.0PHP ^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

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

---

Top Contributors

[![Luthfiahmad12](https://avatars.githubusercontent.com/u/108327868?v=4)](https://github.com/Luthfiahmad12 "Luthfiahmad12 (23 commits)")

---

Tags

laravelpackagemodulesmodularMod

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laravel-mod-core/health.svg)

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

###  Alternatives

[internachi/modular

Modularize your Laravel apps

1.1k662.4k8](/packages/internachi-modular)[artem-schander/l5-modular

Modular pattern generator for Laravel

223235.5k](/packages/artem-schander-l5-modular)[mhmiton/laravel-modules-livewire

Using Laravel Livewire in Laravel Modules package with automatically registered livewire components for every modules.

236409.6k9](/packages/mhmiton-laravel-modules-livewire)

PHPackages © 2026

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