dev-sajid/laravel-modular
Composer 安装命令:
composer require dev-sajid/laravel-modular
包简介
Lightweight Laravel modularization: drop-in modules under modules/ with auto-discovery, no external dependencies.
README 文档
README
Lightweight module system for Laravel 11+ applications. Drop modules under modules/{Name} and they are auto-discovered with zero configuration.
Features
- 🚀 Zero Dependencies: No external packages required
- 🔍 Auto-Discovery: Modules are automatically discovered and registered
- 📦 Convention-based: Follow simple naming conventions for instant setup
- 🎯 Laravel 11+ Compatible: Built for modern Laravel applications
- 🛠️ Artisan Integration: Generate modules with
php artisan make:module - 📁 Flexible Structure: Support for routes, views, migrations, config, translations, and more
- ⚡ High Performance: Lightweight with minimal overhead
Requirements
- PHP 8.2 or higher
- Laravel 11.0 or higher
Installation
Install the package via Composer:
composer require dev-sajid/laravel-modular
The package will auto-register thanks to Laravel's package auto-discovery.
Quick Start
-
Generate a module:
php artisan make:module Blog
-
Your module structure:
modules/ └── Blog/ ├── BlogServiceProvider.php ├── Http/ │ └── Controllers/ │ └── BlogController.php ├── routes/ │ └── web.php ├── resources/ │ └── views/ │ └── index.blade.php ├── Database/ │ └── migrations/ │ └── 2025_08_24_000000_create_blogs_table.php └── lang/ -
Run migrations:
php artisan migrate
-
Access your module: Visit
/blogin your browser!
Configuration
Publish the configuration file (optional):
php artisan vendor:publish --tag=modular-config
This creates config/modular.php:
<?php return [ // Directory where modules are stored 'modules_path' => 'modules', // Base namespace for modules 'namespace' => 'Modules', // Whether to prefer module-specific ServiceProviders 'prefer_module_provider' => true, ];
Module Structure
Each module can contain:
modules/YourModule/
├── YourModuleServiceProvider.php # Optional custom service provider
├── Http/
│ └── Controllers/ # Controllers
├── routes/
│ ├── web.php # Web routes
│ └── api.php # API routes (optional)
├── resources/
│ └── views/ # Blade templates
├── Database/
│ └── migrations/ # Database migrations
├── lang/ # Translations
├── config/ # Module-specific config files
└── helpers.php # Helper functions (optional)
Examples
Creating a Blog Module
php artisan make:module Blog
Generated controller (modules/Blog/Http/Controllers/BlogController.php):
<?php namespace Modules\Blog\Http\Controllers; use Illuminate\Routing\Controller; class BlogController extends Controller { public function index() { return view('blog::index'); } }
Upgrading from v1.x
Version 2.0 includes several breaking changes:
Requirements
- PHP: Now requires 8.2+ (was 8.1+)
- Laravel: Now requires 11.0+ (was 10.0+)
To upgrade:
- Update your
composer.jsonto require PHP 8.2+ - Update to Laravel 11+
- Run
composer update dev-sajid/laravel-modular
License
The MIT License (MIT). Please see License File for more information.
dev-sajid/laravel-modular 适用场景与选型建议
dev-sajid/laravel-modular 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「package」 「modules」 「service-provider」 「laravel」 「modular」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dev-sajid/laravel-modular 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dev-sajid/laravel-modular 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dev-sajid/laravel-modular 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is Paymorrow module for OXID eShop.
WordPress® Settings API service provider
Analysis module for finding problematical shop data.
yii2 swiper slider
An interactive tour through the TYPO3 backend.
Symfony compiler pass that allows to use service providers as defined in container-interop/service-provider
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-23