ichie-benjamin/laravel-code-generator
Composer 安装命令:
composer require ichie-benjamin/laravel-code-generator
包简介
An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cr
README 文档
README
Introduction
An intelligent code generator for Laravel framework that will save you time!! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.
For full documentation and live demo please visit crestapps.com
**Note: ** The this is fork of CrestApps/laravel-code-generator, all credit should go the creator
Features
- One step installation when using Laravel 10+
- Create very clean, reusable and highly readable code to build on.
- Create full resources using a single command with migration or from existing database.
- Creates full resources for all of the existing tables in the database using one command.
- Create full API-based resources using a single command with migration or from existing database.
- Create beautiful documentation for your API.
- Create api-resource and api-resource-collection with Laravel 5.5+.
- Allows you to save the fields in a JSON file and recreate resources when the business needs changes.
- Utilizes JSON based resource-file to allow you to define your resources. Resource-file allows you to easily regenerate the resource at any time even when the business rules change.
- Create standard CRUD controllers with simple or form-request validation.
- Customizable view’s templates to enable you to change the standard look and feel of your application.
- Create model with relations.
- Create named routes with and without group.
- Create standard CRUD views.
- Smart migration engine! Keeps track of all generated migrations to only create the needed migration.
- Intelligent enough to automatically handles the relations between the models.
- Very flexible and rich with configurable options.
- Easy commands to create resource-file; additionally, add or reduce existing resource-file.
- Full capability to generate multi-languages applications.
- Client-side validation.
- File uploading handling.
- Auto store multiple-response in the database.
- Create form-request to clean up your controller and increase your code reusability.
- Create view's layouts with and without client-side validation.
- Change the template at run time to generate different views.
- Ability to generate views with and without Laravel-Collective.
- Nicely handles any date, time or datetime field.
- Auto handles any boolean field.
- Very easy to use with lots of documentation.
Installation
-
To download this package into your laravel project, use the command-line to execute the following command
composer require ichie-benjamin/laravel-code-generator
A layout is required for the default views! The code generator allows you to create a layout using the command-line. Of cource you can use your own layout. You'll only need to include CSS bootstrap framework in your layout for the default templates to work properly. Additionally, you can chose to you design your own templetes using a different or no css framework.
Lessons
Checkout our channel on YouTube.com
Available Commands
The command in between the square brackets [] must be replaced with a variable of your choice.
-
Main commands
- php artisan create:scaffold [model-name]
- php artisan create:controller [model-name]
- php artisan create:model [model-name]
- php artisan create:form-request [model-name]
- php artisan create:routes [model-name]
- php artisan create:migration [model-name]
- php artisan create:language [model-name]
- php artisan create:mapped-resources
-
API commands
- php artisan create:api-scaffold [model-name]
- php artisan create:api-controller [model-name]
- php artisan create:api-resources [model-name]
- php artisan api-doc:create-controller [model-name]
- php artisan api-doc:create-view [model-name]
-
Views commands
- php artisan create:layout [application-name]
- php artisan create:views [model-name]
- php artisan create:index-view [model-name]
- php artisan create:create-view [model-name]
- php artisan create:edit-view [model-name]
- php artisan create:show-view [model-name]
- php artisan create:form-view [model-name]
-
Resource's files commands
- php artisan resource-file:from-database [model-name]
- php artisan resource-file:create [model-name]
- php artisan resource-file:append [model-name]
- php artisan resource-file:reduce [model-name]
- php artisan resource-file:delete [model-name]
-
Migration commands
- php artisan migrate-all
- php artisan migrate:rollback-all
- php artisan migrate:reset-all
- php artisan migrate:refresh-all
- php artisan migrate:status-all
Full documentation available at crestapps.com.
Live demo is available at crestapps.com.
Basic example - CRUD with migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_activeThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-migrationThe above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!
Basic example - CRUD with migration - Shortcut
php artisan create:scaffold AssetCategory --with-migration --fields=id,name,description,is_activeThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json first. Then, it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!. This is a short way to issuing both `resource-file:create` and `create:scaffold` in one line
Basic API example - CRUD with migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_activeThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-migrationThe above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!
Basic example using translations for English and Arabic - with migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_active --translation-for=en,arThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-migrationThe above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration class!
Basic example with form-request
php artisan resource-file:create AssetCategory --fields=id,name,description,is_activeThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-form-requestThe above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and app/Http/Requests/AssetCategoriesFormRequest class!
Basic example with soft-delete and migration
php artisan resource-file:create AssetCategory --fields=id,name,description,is_activeThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
php artisan create:scaffold AssetCategory --with-soft-delete --with-migrationThe above command will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views, the routes, and migration file!
Creating resources from existing database
php artisan create:scaffold AssetCategory --table-existsThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json. It is going to assume that the table name is called "asset_categories" in your database. If that is not the case, you can use --table-name=some_other_table_name
Then it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views and the routes!
You may also create a resource-file from existing database separately using
php artisan resource-file:from-database AssetCategory
Creating resources from existing database with translation for English and Arabic
php artisan create:scaffold AssetCategory --translation-for=en,ar --table-existsThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
Then it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views and the routes!
You may also create a resource-file from existing database separately using
php artisan resource-file:from-database AssetCategory --translation-for=en,ar
Creating resources from existing database with translation for English and Arabic in two step for better control over the fields!
php artisan resource-file:from-database AssetCategory --translation-for=en,ar
php artisan create:scaffold AssetCategoryThe above command will create resource-file names /resources/laravel-code-generator/sources/asset_categories.json
Then it will create a model app/Models/AssetCategory, a controller app/Http/Controllers/AssetCategoriesController, all views and the routes!
License
"Laravel Code Generator" is an open-sourced software licensed under the MIT license
ichie-benjamin/laravel-code-generator 适用场景与选型建议
ichie-benjamin/laravel-code-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 24 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 12 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「crud」 「laravel」 「crud generator」 「laravel crud generator」 「laravel crud builder」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ichie-benjamin/laravel-code-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ichie-benjamin/laravel-code-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ichie-benjamin/laravel-code-generator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Gii Generator for double model generation
A PSR-7 compatible library for making CRUD API endpoints
Admin panel generator for Laravel 8 and based on Vuetify Admin, a separate SPA admin framework running on top of REST APIs.
Collection of tools to use the full power of the Enyalius framework
Laravel Admin CRUD Generator
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-28