定制 ronasit/larabuilder 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ronasit/larabuilder

最新稳定版本:0.0.2

Composer 安装命令:

composer require ronasit/larabuilder

包简介

A great tool for creating and modifying PHP classes in Laravel, providing utilities to generate boilerplate code, add methods, properties, and annotations with ease.

README 文档

README

Coverage Status

Laravel Builder

Installation

composer require ronasit/larabuilder --dev

Usage

The logic of the package usage consists of the three stages:

  1. Open a php file
  2. Call required class modifications methods
  3. Render modified class structure and overwrite existing file
new PHPFileBuilder(app_path('Models/User.php'))
    ->addArrayPropertyItem('fillable', 'is_active')
    ->setProperty('casts', [
        'is_active' => 'boolean',
    ], AccessModifierEnum::Protected)
    ->save();

Features

setProperty

Add new class property with the passed value and passed access level in case property does not exist in the class. Otherwise will change already existing class property's value AND access level

addArrayPropertyItem

Add new item to the array class property. Will add new property in case it does not exist yet.

removeArrayPropertyItem

Remove items from the array class property. If the property or item does not exist no action is taken.

Special Laravel structure builders

Bootstrap app

To modify the Laravel bootstrap app file, use special AppBootstrapBuilder:

new AppBootstrapBuilder()->addExceptionsRender(ExpectationFailedException::class,  '
    throw $exception;
')->save();

addExceptionsRender

Adds a new exception render to the withExceptions called method in case it does not exist yet. Does not modify already added render for the passed exception class.

统计信息

  • 总下载量: 41
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-17