sethios/laravel-tools
Composer 安装命令:
composer require sethios/laravel-tools
包简介
Several tools for Laravel development
README 文档
README
A set of tools for generating basic Laravel scaffolding (including Model, Controller, View, Seeders, Migrations...).
It also includes a tool for database reseeding via Factories and/or CSV file.
Installation:
Require the package with composer:
composer require --dev sethios/laravel-tools
After installation run this command for the DB reseed function to work:
php artisan vendor:publish --tag=config
The generated config file includes basic User model configuration. You can add any other model.
Database reseed
Reseed a table (or tables) with php artisan by running:
php artisan db:reseed user
Parameters
- "reset" -> (optional) name of migration file, used if you wish to re-migrate
- "tables" -> array of database table names you wish to reset when running a db:reseed
- "class" -> name od model seeder class ex. UserSeeder
Create MVC
Generate scaffolding for a model by running:
php artisan create:mvc user
The default command will generate the following files:app/Models/User.php
app/Http/Requests/UserRequest.php
app/Http/Controllers/UserController.php
app/Events/UserEvent.php
app/Listeners/UserDeleted.php
app/Listeners/UserStored.php
app/Listeners/UserUpdated.php
app/Observers/UserObserver.php
database/migrations/2021_02_05_105447_create_users_table.php
database/factories/UserFactory.php
database/seeds/UserSeeder.php
resources/lang/en/user.php
resources/js/includes/user.js
resources/views/user/index.blade.php
resources/views/user/new.blade.php
resources/views/user/edit.blade.php
resources/views/user/partials/form.blade.php
resources/views/user/partials/userListItem.blade.php
resources/views/user/partials/actions.blade.php
resources/views/user/partials/inputs.blade.php
It will also try and modify these files by searching for the commented line "Create mvc" used as a placeholder: [^1]
routes/web.php
resources/views/layouts/partials/sidebar.blade.php
app/Providers/AppServiceProvider.php
app/Providers/EventServiceProvider.php
database/seeds/DatabaseSeeder.php
resources/js/app.js
Options
There are several flags that can be used that reduce the amount of files generated i.e. specify which files you want to generate:
--m : Include Model, migration
--c : Include Controller and route
--b : Include Blade, CSS, JS files and route
--s : Include Seeder and Factory
--l : Include logic in AppServiceProvider, Events, Listeners and Observers
To Do
- Remove the need for commented placeholders in files that need to be modified [^1]
- Include a JSON and/or config file to pre-setup a models generation i.e. pre-define models attributes / database columns. Make it so it also generates the code for Seeders and Factories
- Automated model relations via pre-defined attributes configuration
sethios/laravel-tools 适用场景与选型建议
sethios/laravel-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 63 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sethios/laravel-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sethios/laravel-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 63
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-11