Download the PHP package kareem22t/structure-my-module without Composer
On this page you can find all versions of the php package kareem22t/structure-my-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kareem22t/structure-my-module
More information about kareem22t/structure-my-module
Files in kareem22t/structure-my-module
Package structure-my-module
Short Description Laravel package for generating structured modules
License MIT
Informations about the package structure-my-module
Structure My Module
A Laravel package to generate structured modules with controllers, models, services, repositories, and other related files, following a clean and organized structure.
Installation
-
Install the package via Composer:
- For Laravel 11+ and API/Auth-Sanctum types, install Laravel Sanctum:
Command Overview
The package provides the make:module
command, which creates a complete module structure based on the specified parameters.
Command Signature
Parameters
prefix
(optional): A prefix for the module files (e.g., "Admin").name
(required): The singular, uppercase name of the module (e.g., "User").type
(required): The type of module to create. Must be one of:mvc
: Creates an MVC-based moduleapi
: Creates an API-based moduleauth-mvc
: Creates an MVC-based authentication moduleauth-sanctum
: Creates an API-based authentication module with Sanctum
Validation Rules
type
: Must be eithermvc
,api
,auth-mvc
, orauth-sanctum
name
: Must be singular and uppercase (e.g.,User
, notUsers
oruser
)prefix
: If provided, must be singular and uppercase (e.g.,Admin
, notAdmins
oradmin
)
Generated Files
The command generates different files based on the module type:
Common Files for All Types
- Model
- Repository Interface and Implementation
- Service Class
Type-Specific Files
MVC Type
- Web Controller with CRUD operations
- Store and Update request classes
- Views (to be created manually)
API Type
- API Controller with CRUD operations
- Store and Update request classes
- Resource and Collection classes
- API Response handling
Auth MVC Type
- Web Authentication Controller with:
- Register
- Login
- Show Profile
- Update Profile
- Logout
- Login, Register, and Update request classes
- Views (to be created manually)
Auth Sanctum Type
- API Authentication Controller with:
- Register (returns token)
- Login (returns token)
- Show Profile
- Update Profile
- Logout (revokes tokens)
- Login, Register, and Update request classes
- Resource class
- API Response handling
Post-Generation Steps
After generating your module, follow these steps to complete the setup:
1. Run Migration
2. Set Up Routes
For MVC/Auth-MVC Types
For API/Auth-Sanctum Types
3. Customize Request Validation
Add your validation rules in the generated request classes:
4. Configure User Model (for Auth Types)
Make sure your User model is properly configured:
Examples
Creating an MVC Authentication Module
Creating a Sanctum API Authentication Module
Creating a Prefixed Module
API Response Structure
For API and Auth-Sanctum types, responses follow this structure: