creativesofttechsolutions/laravelmodules
最新稳定版本:v1.0.0
Composer 安装命令:
composer require creativesofttechsolutions/laravelmodules
包简介
A lightweight and powerful module/plugin manager for Laravel applications.
README 文档
README
A modular management package for Laravel, enabling seamless integration and structured development for Laravel-based projects.
Features
- Modular Structure: Each module contains its own controllers, routes, views, configurations, and more.
- Hooks System: Supports actions and filters for customizable functionality.
- Tenant Support: Includes tenant-specific migrations and configurations for multitenancy.
- Artisan Commands: Simplified commands to create modules, controllers, middleware, models, and migrations.
Module Structure
Modules are stored in the modules/ directory and follow this organized structure:
modules/Blog/
├── Config/
│ ├── config.php
│ ├── navbar_config.php
│ └── hooks.php # Example filters & actions
├── Controllers/
│ └── BlogController.php
├── Middleware/
├── Migrations/
├── Providers/
│ └── BlogServiceProvider.php # Auto-loads views, routes, hooks
├── Resources/
│ └── views/
│ └── index.blade.php
├── Routes/
│ ├── web.php # Web routes
│ ├── central.php # Central routes
│ └── tenant.php # Tenant routes
Installation
Install the package via Composer:
composer require creativesofttechsolutions/laravelmodules
Publish configuration files:
php artisan vendor:publish --tag=modules-config
Usage
Create a New Module
Create a module using the Artisan command:
php artisan make:module Blog
Create a New Controller
Add a controller to a module:
php artisan module:make-controller Blog TestController
Create Middleware
Generate middleware for a module:
php artisan module:make-middleware Blog TestMiddleware
Register middleware in the module's service provider:
$router = $this->app['router']; $router->aliasMiddleware('example.middleware', ExampleMiddleware::class);
Create a Model
Add a model to a module with an associated migration:
php artisan module:make-model Blog Post -m
Create a Migration
Generate a migration for a module:
php artisan module:make-migration Blog create_posts_table
Tenant-Specific Features
Run Tenant Migrations
php artisan tenant:migrate --domain=demo.mlmmultitenancy.test --fresh
Run Tenant Migrations with Seeders
php artisan tenant:migrate --domain=demo.mlmmultitenancy.test --fresh --seed
Configuration
Hooks System
Customize functionality with hooks.php:
add_action('example_action', function ($args) { // Perform your action here }); apply_filters('example_filter', $data);
Auto-Loading
The BlogServiceProvider automatically registers:
- Routes
- Views
- Configurations
- Hooks
Contribution
Contributions are welcome! Feel free to submit issues or pull requests to improve this package.
License
This package is open-source software licensed under the MIT license.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-14