arpanmandaviya/laravel-system-builder

Generate Laravel migrations, models, controllers, and views from a minimal JSON schema (Laravel 12+)

Maintainers

Package info

github.com/arpanmandaviya07/sysgen

pkg:composer/arpanmandaviya/laravel-system-builder

Statistics

Installs: 39

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.23 2025-12-04 05:51 UTC

This package is auto-updated.

Last update: 2026-03-19 05:20:07 UTC


README

A professional Laravel package that lets you generate complete application scaffolding including:

  • πŸ“ Database Migrations
  • 🧬 Eloquent Models
  • πŸŽ›οΈ Controllers
  • 🎨 Blade Views

All automatically β€” powered by a single JSON file.

πŸ“Œ Installation & Requirements

Install the package using Composer:

composer require arpanmandaviya/laravel-system-builder

Place a JSON definition file anywhere in your Laravel project, for example:

storage/app/system.json

⚑ Generate Your System

Run the build command:

php artisan system:build --json=storage/app/system.json

To overwrite existing files:

php artisan system:build --json=storage/app/system.json --force

Note: Gave the Path of The File In The Command Otherwise it Show Error For More Information Please Use Help Command

πŸ“ Example JSON Structure

{
	/*
	|--------------------------------------------------------------------------
	| 1. Table Definitions
	|--------------------------------------------------------------------------
	| Defines database tables, columns, primary keys, and foreign keys.
	| This section drives Migration and Model generation.
	*/
	"tables": [
		{
			"name": "users",
			"columns": [
				{ "name": "id", "type": "bigIncrements" },
				{ "name": "name", "type": "string", "length": 100, "comment": "Full name of the user" },
				{ "name": "email", "type": "string", "length": 150, "unique": true },
				{ "name": "password", "type": "string", "length": 255 },
				{ 
					"name": "role_id", 
					"type": "unsignedBigInteger", 
					"foreign": { 
						"on": "roles",             /* Target table */
						"references": "id",        /* Target column */
						"onDelete": "cascade"      /* MySQL action */
					} 
				}
			]
		},
		{
			"name": "workers",
			"columns": [
				{ "name": "id", "type": "bigIncrements" },
				{ 
					"name": "user_id", 
					"type": "unsignedBigInteger", 
					"foreign": { "on": "users", "references": "id", "onDelete": "cascade" } 
				},
				{ "name": "position", "type": "string", "length": 100 },
				{ "name": "salary", "type": "decimal", "length": "10,2" },
				{ "name": "status", "type": "enum", "values": ["active", "inactive"], "default": "active" } 
			]
		}
	],
	
	/*
	|--------------------------------------------------------------------------
	| 2. Controller Definitions
	|--------------------------------------------------------------------------
	| Explicitly defines controllers to be generated. If a table-based controller
	| (e.g., 'PostController' for table 'posts') is NOT listed here, it is
	| automatically inferred and generated with default resource methods.
	*/
	"controllers": [
		{ "name": "UserController", "table": "users", "model": "User" },
		{ "name": "WorkerController", "table": "workers", "model": "Worker" }
	],

	/*
	|--------------------------------------------------------------------------
	| 3. Model Definitions & Relationships
	|--------------------------------------------------------------------------
	| Defines models and their Eloquent relationships. Used to populate the
	| Model's `$fillable` array and add relationship methods.
	*/
	"models": [
		{ 
			"name": "User", 
			"table": "users", 
			"relations": [
				"role:belongsTo", 
				"workers:hasMany" 
			]
		},
		{ 
			"name": "Worker", 
			"table": "workers", 
			"relations": [
				"user:belongsTo", 
				"tasks:hasMany" 
			] 
		}
	],
	
	/*
	|--------------------------------------------------------------------------
	| 4. View Scaffolding
	|--------------------------------------------------------------------------
	| Defines general view files and structure (not tied to a specific table).
	| Syntax: "{folder}/[file1,file2,file3]" creates files in resources/views/{folder}.
	*/
	"views": [
		"admin/includes/[head]",
		"admin/partials/[sidebar,navbar,footer,script]"
	]
}

πŸ†˜ Need Help?

You can access built-in help:

php artisan system:help

πŸ“Œ Features

Feature Status
Automatic Migrations βœ”
Automatic Models βœ”
Automatic Controllers βœ”
View Scaffolding βœ”
Relationship Support βœ”
JSON-based Definition βœ”
Foreign Key Generator βœ”
Enum / JSON / Custom Field Support βœ”
GUI Form Designer ⏳ Coming Soon

πŸ‘¨β€πŸ’» Author & Credits

Created with ❀️ by Arpan Mandaviya

If you're using this in a commercial product, a mention or sponsorship is appreciated (optional).

πŸ“œ License

Copyright Β© 2025-present
Owner: Arpan Mandaviya

Permissions:

βœ” Free to use in personal and commercial projects
βœ– Cannot remove credits
βœ– Cannot claim ownership
βœ– Cannot sell modified versions as a competing product

Future versions may introduce licensing terms. Continued usage of updated versions implies acceptance.

⚠ Warranty Disclaimer

This software is provided β€œAS IS”, without warranty of any kind.
Use at your own risk.

CLI Command Reference

The Laravel System Builder provides additional optional commands for generating individual resources without requiring a JSON file.

πŸ”₯ Laravel System Builder CLI Commands

Below is a list of available System Builder commands, including their help options for guidance.

━━━ πŸ“Œ Generate Migration Files (Interactive Mode) ━━━

Create new database migration files interactively:

php artisan system:migrate

View detailed help, supported datatypes, and usage examples:

php artisan system:migrate --help

━━━ πŸ“Œ Generate a Model (Existing or New Table Support) ━━━

Create a new Model with optional relationship setup:

php artisan system:model

View help and available flags:

php artisan system:model --help

━━━ πŸ“Œ Generate a Controller (Resource or Standard) ━━━

Create a fully scaffolded controller:

php artisan system:controller

View controller command syntax, options, and usage guide:

php artisan system:controller --help

━━━ πŸ’‘ Tip: ━━━

You can run any of these commands without arguments. The System Builder will guide you with interactive questions allowing you to:

βœ” Select controller type  
βœ” Add relationships  
βœ” Detect existing tables  
βœ” Define columns and keys  
βœ” Generate resource boilerplate automatically

No JSON file required β€” everything works interactively.