Download the PHP package nahid-ferdous/laravel-module-generator without Composer
On this page you can find all versions of the php package nahid-ferdous/laravel-module-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nahid-ferdous/laravel-module-generator
More information about nahid-ferdous/laravel-module-generator
Files in nahid-ferdous/laravel-module-generator
Package laravel-module-generator
Short Description Laravel Package to generate module (service, controller, model, migration, resource, request, collection) from YAML file.
License MIT
Homepage https://github.com/nahidnfr123/laravel-module-generator
Informations about the package laravel-module-generator
Laravel Module Generator
A developer-friendly Laravel package to generate complete modules (Model, Migration, Controller, Service, Resource, Collection, Form Request, and Routes) from a single YAML configuration file. Now includes Postman collection generation and DB diagram export for streamlined API development and documentation.
โจ Features
- Generate full Laravel modules from YAML configuration
- Customizable stub support (with fallback to internal defaults)
- ๐ Postman collection generation for instant API testing
- ๐ Database diagram export compatible with dbdiagram.io
- Generates:
- Models with relationships
- Database migrations
- API Controllers
- Service classes
- Form Request validation
- API Resources & Collections
- Route entries
- Postman collection files
- DB diagram files (.dbml)
- Smart fillable and relationship handling
- Designed for rapid development and prototyping
๐ Installation
Install the package via Composer:
๐ฆ Service Provider
Generate required files and configurations:
๐ Optional: Publish Config & Stubs
You may publish the configuration and stub files to customize them. If you don't publish them, the package will use its built-in defaults automatically.
This will publish:
- Config:
config/module-generator.php
- Stubs:
module/stub/
๐ ๏ธ Usage
1. Create Your YAML Configuration
Create a YAML file at the default path: module/models.yaml
Define your models with their fields, validation rules, and relationships:
Example: module/models.yaml
2. Generate Your Complete Module
Generate the complete module structure with all features:
Available Options:
3. Generate Individual Components
You can also generate specific components separately:
Generate Postman Collection Only
Generate DB Diagram Only
Backup Existing Files While Generating
๐งช What Gets Generated
For each model defined in your YAML file, the package will generate:
Core Laravel Components
- โ
Eloquent Model โ
app/Models/
- โ
Migration โ
database/migrations/
- โ
API Controller โ
app/Http/Controllers/
- โ
Service Class โ
app/Services/
- โ
Form Request โ
app/Http/Requests/
- โ
API Resource โ
app/Http/Resources/
- โ
Resource Collection โ
app/Http/Resources/
- โ
Route Registration โ
routes/api.php
๐ Documentation & Testing
- โ
Postman Collection โ
module/postman_collection.json
- โ
DB Diagram โ
module/dbdiagram.dbml
๐ Postman Collection Features
The generated Postman collection includes:
- Complete CRUD operations for each model
- Proper HTTP methods (GET, POST, PUT, DELETE)
- Request examples with sample data
- Environment variables for base URL and API prefix
- Organized folder structure by model
- Authentication placeholders
Sample generated endpoints:
๐๏ธ Database Diagram Features
The generated DB diagram (.dbml) includes:
- Complete table definitions with all columns
- Relationship mappings (foreign keys, indexes)
- Data types and constraints
- Compatible with dbdiagram.io for visualization
- Exportable to various formats (PNG, PDF, SQL)
Usage with dbdiagram.io:
- Copy the content from
module/dbdiagram.dbml
- Visit dbdiagram.io
- Paste the content to visualize your database schema
- Export as needed (PNG, PDF, SQL)
๐งฑ Stub Customization
This package allows you to override any of the stubs it uses for complete customization of generated code.
Default Stub Configuration
Customizing Stubs
If you published the stubs with:
You can edit them at: module/stub/
Each stub file uses placeholders that get replaced during generation, allowing you to maintain consistency across your entire codebase.
โ๏ธ Configuration
To change the YAML path or customize stub names, update config/module-generator.php
:
๐ YAML Schema Guide
Field Types
string
- VARCHAR fieldstring:unique
- VARCHAR with unique constraintstring:nullable
- Nullable VARCHARboolean:default true
- Boolean with default valueforeignId:table_name
- Foreign key referencedouble
- Double/float field
Relationship Types
belongsTo
- Belongs to relationshiphasMany
- Has many relationshiphasOne
- Has one relationshipbelongsToMany
- Many-to-many relationship
Unique Constraints
Define composite unique constraints:
Selective Generation
Control what gets generated for each model:
๐ Complete Workflow Example
Here's a complete workflow from YAML to production-ready API:
๐ Versioning
This package follows Semantic Versioning. Use tags like v1.0.0
, v1.1.0
, etc., when pushing updates to Packagist.
๐ค Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๐ License
This package is open-sourced software licensed under the MIT license.
๐ Credits
Created and maintained by Nahid Ferdous
Special thanks to the Laravel community and all contributors who help improve this package.
๐ Issues & Support
If you encounter any issues or have questions:
- Check the existing issues
- Create a new issue with detailed information
- Include your YAML configuration and error messages
๐ Roadmap
- [x]
Postman collection generation - [x]
Database diagram export - [ ] Support for additional relationship types
- [ ] GUI for YAML configuration
- [ ] Integration with Laravel Sanctum
- [ ] Custom validation rule generation
- [ ] Support for nested resources
- [ ] OpenAPI/Swagger documentation generation
- [ ] Insomnia collection export
- [ ] GraphQL schema generation
๐ Recent Updates
v1.0.10
- โ NEW: Postman collection generation
- โ NEW: Database diagram export (dbdiagram.io compatible)
- โ NEW: Selective component generation
- โ IMPROVED: Enhanced command options and flexibility
- โ IMPROVED: Better error handling and user feedback
Happy coding! ๐
All versions of laravel-module-generator with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
symfony/yaml Version ^6.0 || ^7.0