Download the PHP package ronasit/larabuilder without Composer
On this page you can find all versions of the php package ronasit/larabuilder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ronasit/larabuilder
More information about ronasit/larabuilder
Files in ronasit/larabuilder
Package larabuilder
Short Description A great tool for creating and modifying PHP classes in Laravel, providing utilities to generate boilerplate code, add methods, properties, and annotations with ease.
License MIT
Informations about the package larabuilder
Laravel Builder
For internal architecture and contributor guidance, see ARCHITECTURE.md.
Installation
Usage
The 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
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.
insertCodeToMethod
Insert the provided code into the specified method body at the desired position - by default, to the end of the method.
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
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
Add a new method to a class, trait, or enum. Throws NodeAlreadyExistsException if a method with the given name already exists.
removeMethod
Remove a method by name from a class, trait, enum, or interface.
Special Laravel structure builders
Bootstrap app
To modify the Laravel bootstrap app file, use special AppBootstrapBuilder:
This builder has all the features described above and the special methods:
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
Thank you for considering contributing to Laravel Builder package! The contribution guide can be found in the Contributing guide.
License
Laravel Builder package is open-sourced software licensed under the MIT license.