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.

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 3

pkg:composer/ronasit/larabuilder

0.0.1 2025-11-24 02:24 UTC

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.