infancyit/igloo
Composer 安装命令:
composer require infancyit/igloo
包简介
An automated process for create basic CRUD functionality
README 文档
README
Contents
Change Log
New in v1.2
- GUI support inside the package
- Drop Down API included
- Several Bug Fixed
New in v1.1
- Laravel 5.7 Support
- Namespace Supports
- Several Bug Fixed
Installation
-
To install Igloo Code Generator, run the following command:
composer require infancyit/igloo
-
Run the command below to load all configuration file:
php artisan vendor:publish --provider="InfancyIt\Igloo\IglooServiceProvider" -
For allowing CORS on a API middleware group or route, add the
HandleCorsmiddleware tomiddlewarearray in theKernel.phpfile:protected $middleware = [ ... ... ... ... ... ... ... ... ... ... \Barryvdh\Cors\HandleCors::class, ];
Usage
Create Model
Let's start by creating a basic Model:
Model will be saved on app\Models folder.
Run the following command on project root.
php artisan make-model Book
If you want to add fillable or guarded value you may pass the list of columns as well:
php artisan make-model Book --fillable=name,author,published_date
or
php artisan make-model Book --guarded=id
or
php artisan make-model Book --fillable=name,author,published_date --guarded=id
Create Service
Let's create some basic Service which will extends our BaseService from app\Services:
Run the following command on project root.
php artisan make-service Book
Create Repository
Let's create some basic Repository which will extends our BaseRepository from app\Repositories:
Run the following command on project root.
php artisan make-repository Book
Create Transformer
Let's create a basic Transformer:
Transformer will be created in the app/Transformers/Api folder.
Run the following command on project root.
php artisan make-transformer Book id,name,author,published_date
In the creation of Transformer attributes list are required. All columns should be separated by a single , (comma). This will create the main portion like this
public function getTransformableFields($entity)
{
return [
'id' => (int) $entity->id,
'name' => $entity->name,
'author' => $entity->author,
'published_date' => $entity->published_date
];
}
Create Request
Let's create a basic Request:
Transformer will be created in the app/Request/Api folder.
Run the following command on project root.
php artisan make-request Book id,name,author,published_date
In the creation of Request attributes list are required. All columns should be separated by a single , (comma). This will create the main portion like this
public function rules()
{
return [
'name' => 'required',
'author' => 'required',
'published_date' => 'required'
];
}
Create Route
You can also create API routes for your model. Run the following command on project root.
php artisan make-route Book
This command will output like this:
///////////////////////////// Book Routes //////////////////////////////
Route::group(['prefix' => 'book', 'namespace' => 'Api'], function () {
Route::get('index', 'BookController@index')->name('book.index');
Route::post('create', 'BookController@store')->name('book.store');
Route::post('update', 'BookController@update')->name('book.update');
Route::delete('delete', 'BookController@delete')->name('book.delete');
});
This command will not save anything. You've to copy this segment from console and paste it in your web.php or api.php file.
The assumption for the controller name will be [Modelname]Controller.
Installation
-
For bundle create visit
-
Or you can visit
\iglooroute after package installation.
License
Igloo Code Generator is free software distributed under the terms of the MIT license.
infancyit/igloo 适用场景与选型建议
infancyit/igloo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 134 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 infancyit/igloo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 infancyit/igloo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 134
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-11-16