abacus/module-builder
最新稳定版本:v3.0.2
Composer 安装命令:
composer require abacus/module-builder
包简介
A Laravel inhouse package for building modules
README 文档
README
Module builder created to escape the boilerplating when creating new modules, based on 3-layer app
- Business ( Provider, Data, Creator, Facade )
- Communication ( Controller, Request )
- Persistence ( Model, Migration, Saver, Updater, Deleter )
The core principle
This package is organized the same way the modules are generated, across that,
it uses chain responsability for the factory services to generate the classes.
How to use
To generate a new whole module, for example CarModule, you would type into the terminal.
If you want it to be translated, you add the --translated option to the command.
php artisan abacus:create:module Car
Don't forget to update your bootstrap/providers.php
<?php use App\Providers\AppServiceProvider; use App\Business\Car\CarServiceProvider; return [ AppServiceProvider::class, CarServiceProvider::class, ];
PS: In case your default controller is moved from default location,update the Communication/{module}/Controllers/*Controller.php accordingly.
<?php declare(strict_types=1); namespace App\Communication\Car\Controllers; use App\Business\Car\Data\CarData; use App\Business\Car\Facades\CarFacade; use App\Communication\Car\Requests\CarRequest; use App\Http\Controllers\Controller; // <- Check this class CarController extends Controller { public function __construct(private readonly CarFacade $facade) { } public function store(CarRequest $request): int { return $this->facade->store(CarData::fromRequest($request)); } public function update(int $id, CarRequest $request): int { return $this->facade->update($id, CarData::fromRequest($request)); } public function delete(int $id): ?bool { return $this->facade->delete($id); } }
统计信息
- 总下载量: 62
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-26