Download the PHP package williamug/modular without Composer
On this page you can find all versions of the php package williamug/modular. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download williamug/modular
More information about williamug/modular
Files in williamug/modular
Package modular
Short Description The Modular provides a modular architecture for Laravel applications, allowing you to organize your application into self-contained modules. This package is inspired by the concept of modular programming, making it easier to manage large applications.
License MIT
Homepage https://github.com/williamug/modular
Informations about the package modular
Modular
The Modular provides a modular architecture for Laravel applications, allowing you to organize your application into self-contained modules. This package is inspired by the concept of modular development, making it easier to manage large applications.
Features
- Create, enable, disable, and delete modules.
- Run migrations, seeders, and publish assets for specific modules.
- Generate controllers, models, and migrations within modules.
- Dynamic module loading and management.
- Supports both API-only and full-stack Laravel projects.
Installation
Install the package via Composer:
Run the installation command to set up the package:
This will publish the configuration file and configure your frontend.
Available Commands
Creating a Module
To create a new module, use the module:create command:
This will create a Expense module in the Modules directory with the following structure:
Enabling and Disabling Modules
Enable a module:
Disable a module:
Deleting a Module
Delete a module:
Running Migrations
Run migrations for a specific module:
Seeding Data
Seed data for a specific module:
Publishing Assets
Publish assets for a specific module:
Generating Files
Generate a controller within a module:
Generate a model within a module:
Generate a migration within a module:
Viewing Module Information
View detailed information about a module:
Modular Navigation
Modules can register navigation items by adding a navigation key to their module.json. You can use advanced features like icons, groupings, and permissions:
Helper Usage
In your sidebar Blade view, use the helper:
Grouped Navigation Example
Blade Directive Usage
Or use the Blade directive for a concise syntax:
This will automatically render grouped navigation items from all enabled modules, showing icons and respecting permissions.
Modular Content Injection
Modules can inject custom content into parent layouts or pages (e.g., settings, dashboard widgets, or any slot) by adding a settings, widgets, or content key to their module.json:
Helper Usage for Settings
In your unified settings page:
Or use the Blade directive:
Helper Usage for Widgets
In your dashboard:
Or use the Blade directive:
Helper Usage for Generic Content
In any parent layout or page:
Or use the Blade directive:
Example Module Content (banner.blade.php)
Example Project
Setting Up a Expense Module
-
Create the Module:
-
Add Routes: Edit
Modules/Expense/routes/web.php: -
Create a Controller:
Edit
Modules/Expense/Http/Controllers/ExpenseController.php: -
Add a Model:
Edit the generated migration file to define the
poststable schema. -
Run Migrations:
-
Enable the Module:
- Access the Module:
Visit
/expensein your browser to see the Expense module in action.
API-Only Projects
For API-only projects, the package automatically skips frontend scaffolding. You can still use all the commands to manage modules and their backend logic.
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss changes.
License
This package is open-source software licensed under the MIT license.
All versions of modular with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0
illuminate/support Version ^11.0||^12.0