PHPackages                             ronasit/larabuilder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ronasit/larabuilder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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.

0.0.9(2w ago)41.2k[8 issues](https://github.com/RonasIT/larabuilder/issues)[9 PRs](https://github.com/RonasIT/larabuilder/pulls)1MITPHPPHP ^8.4CI passing

Since Oct 10Pushed 3w agoCompare

[ Source](https://github.com/RonasIT/larabuilder)[ Packagist](https://packagist.org/packages/ronasit/larabuilder)[ RSS](/packages/ronasit-larabuilder/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (26)Versions (33)Used By (1)

[![Coverage Status](https://camo.githubusercontent.com/1a4d93746c59a9bad0419338b4a28c1fad1f1cf7b6bc4cd370515bf33b57ef9b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f526f6e617349542f6c6172616275696c6465722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/RonasIT/larabuilder?branch=master)

Laravel Builder
===============

[](#laravel-builder)

For internal architecture and contributor guidance, see [ARCHITECTURE.md](ARCHITECTURE.md).

Installation
------------

[](#installation)

```
composer require ronasit/larabuilder --dev
```

Usage
-----

[](#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

[](#features)

#### setProperty

[](#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

[](#addarraypropertyitem)

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

#### removeArrayPropertyItem

[](#removearraypropertyitem)

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

#### insertCodeToMethod

[](#insertcodetomethod)

Insert the provided code into the specified method body at the desired position - by default, to the end of the method.

#### addImports

[](#addimports)

Add new imports to the file. This method will add a new import only in case it does not exist yet, preventing duplicate `use` statements.

#### addTraits

[](#addtraits)

Add new `use TraitName;` statements to a class, trait, or enum. This method automatically adds the corresponding `use` imports at the top of the file and prevents duplicate trait usages.

**Note:** Need to provide the full trait class name (FQCN); the method will import it automatically.

#### addMethod

[](#addmethod)

Add a new method to a class, trait, or enum. Throws `NodeAlreadyExistsException` if a method with the given name already exists.

```
new PHPFileBuilder(app_path('Http/Controllers/UserController.php'))
    ->addMethod(
        name: 'delete',
        code: '
            $service->delete($id);
            return response()->noContent();
        ',
        params: new MethodParamsList(
            new MethodParamDTO(name: 'request', type: 'DeleteRequest'),
            new MethodParamDTO(name: 'service', type: 'UserService'),
            new MethodParamDTO(name: 'id', type: 'int'),
        ),
        returnType: 'Response',
    )
    ->save();
```

#### removeMethod

[](#removemethod)

Remove a method by name from a class, trait, enum, or interface.

Special Laravel structure builders
----------------------------------

[](#special-laravel-structure-builders)

### Bootstrap app

[](#bootstrap-app)

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

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

This builder has all the features described above and the special methods:

#### addExceptionsRender

[](#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.

**Note** Need to provide the full exception class name (FQCN) to the method, it automatically imports it.

Contributing
------------

[](#contributing)

Thank you for considering contributing to Laravel Builder package! The contribution guide can be found in the [Contributing guide](CONTRIBUTING.md).

License
-------

[](#license)

Laravel Builder package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance71

Regular maintenance activity

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~25 days

Recently: every ~34 days

Total

9

Last Release

17d ago

PHP version history (2 changes)0.0.1PHP ^8.3

0.0.2PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1585993?v=4)[Evgeny Leonov](/maintainers/eleonov)[@eleonov](https://github.com/eleonov)

![](https://avatars.githubusercontent.com/u/129854316?v=4)[DPankratov](/maintainers/DPankratov)[@dpankratov](https://github.com/dpankratov)

![](https://avatars.githubusercontent.com/u/11055414?v=4)[Alexander Storozhevsky](/maintainers/astorozhevsky)[@astorozhevsky](https://github.com/astorozhevsky)

---

Top Contributors

[![artengin](https://avatars.githubusercontent.com/u/152782500?v=4)](https://github.com/artengin "artengin (223 commits)")[![DenTray](https://avatars.githubusercontent.com/u/9486872?v=4)](https://github.com/DenTray "DenTray (95 commits)")[![AZabolotnikov](https://avatars.githubusercontent.com/u/110885041?v=4)](https://github.com/AZabolotnikov "AZabolotnikov (27 commits)")[![pirs1337](https://avatars.githubusercontent.com/u/98943794?v=4)](https://github.com/pirs1337 "pirs1337 (6 commits)")[![yburlakov](https://avatars.githubusercontent.com/u/3166802?v=4)](https://github.com/yburlakov "yburlakov (2 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ronasit-larabuilder/health.svg)

```
[![Health](https://phpackages.com/badges/ronasit-larabuilder/health.svg)](https://phpackages.com/packages/ronasit-larabuilder)
```

###  Alternatives

[knuckleswtf/scribe

Generate API documentation for humans from your Laravel codebase.✍

2.3k14.2M63](/packages/knuckleswtf-scribe)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.4k](/packages/blair2004-nexopos)[v.chetkov/php-clean-architecture

PHP Clean Architecture

14661.1k](/packages/vchetkov-php-clean-architecture)[stillat/proteus

Provides utilities for parsing and updating Laravel-style PHP configuration files.

18349.5k38](/packages/stillat-proteus)[drupal-code-builder/drupal-code-builder

Code generator for Drupal

27253.3k1](/packages/drupal-code-builder-drupal-code-builder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
