composer require ronasit/larabuilder --devThe logic of the package usage consists of the three stages:
- Open a
phpfile - Call required class modifications methods
- 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();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
Add new item to the array class property. Will add new property in case it does not exist yet.