Download the PHP package kaue-f/laravel-structura without Composer
On this page you can find all versions of the php package kaue-f/laravel-structura. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kaue-f/laravel-structura
More information about kaue-f/laravel-structura
Files in kaue-f/laravel-structura
Package laravel-structura
Short Description Laravel-Structura is a tool designed to streamline and standardize the creation of resources in Laravel, promoting a more organized and scalable development structure.
License MIT
Homepage https://github.com/kaue-f/laravel-structura
Informations about the package laravel-structura
English | π§π· PortuguΓͺs
Laravel Structura
Structura comes from Latin and means structure and organization, reflecting the package's purpose.
π Introduction
Structura comes from Latin and means structure and organization, reflecting the package's purpose.
Laravel Structura is a Laravel package designed to simplify, standardize, and structure the creation of application resources, promoting a clean, scalable, and well-organized development environment.
Through custom Artisan commands, the package enables the automatic generation of classes such as Actions, Cache, Data, Enums, Helpers, Services and Traits, encouraging clear separation of responsibilities and solid architectural best practices.
The main goal of Structura is to reduce repetitive tasks, ensure structural consistency, and help developers keep Laravel projects well-organized as they grow.
β¨ Features
- β Action generation with Makeable & Transaction support
- β Cache generation with CacheSupport extension
- β Data generation with readonly/final patterns
- β
Enum generation with PHP Attributes and
toData()mapping - β Helper generation with global autoload registration
- β Trait generation
- β Service generation with ServiceResult and Makeable support
- β Automatic namespace organization
- β Consistent architectural patterns
- β
Centralized configuration via the
config/structura.phpfile - β CLI options override default configuration
- β Automatic suffix enforcement per class type
π Requirements
- PHP ^8.2
- Laravel ^10.x | ^11.x | ^12.x
π¦ Installation
βοΈ Publishing the configuration file
This command creates a new structura.php file in the Laravel application's config directory. It controls namespaces, paths, suffixes, and default options for each generator.
π AI Integration (Laravel Boost)
This package ships with a built-in Laravel Boost skill. If your project uses Boost, the Structura skill is automatically discovered and installed when you run:
Once installed, your AI agent will understand the Structura architecture β Actions, Services, Data, Enums, Caches, and Helpers β and follow all naming conventions and patterns automatically.
π Available commands
| Command | Description |
|---|---|
structura:action |
Create Action classes with Makeable & Transaction support |
structura:cache |
Create Cache classes with optional CacheSupport |
structura:data |
Create Data classes with readonly/final patterns |
structura:enum |
Create Enum classes with PHP Attribute mapping |
structura:helper |
Create Helper classes or global helpers |
structura:service |
Create Service classes with Result & Makeable |
structura:trait |
Create Trait classes |
structura:install |
Publish Structura configuration file |
π Usage examples
Action
Default method:
execute(). Override with--handle,--invokable, or--construct.Pro Tip: By default,
makeableistrueinconfig/structura.phpβ every new Action is ready forLogoutAction::run()usage out of the box!
Cache
By default, the class inherits helper methods from
CacheSupport(e.g.,remember(),forget()). Use--rawto create a plain standalone class.
Data
Data classes are
final readonlyby default following PHP 8.2 best practices. Generated Data classes implementJsonSerializableand useInteractsWithData, providingmake(),from(),fromRequest(),fromArray(),toArray(), and native JSON serialization. ExtendDataSupportonly when an abstract base class is more suitable than a trait.--rawcannot be combined with other flags.
Enum
Modern Enum Usage: Use
toData()for powerful frontend integration:The
InteractsWithEnumtrait addstryFromDefault()fallback support.#[Label],#[Color],#[Icon], and#[DefaultCase]Attributes are supported.
Helper
The
--globalflag automatically updatescomposer.jsonand runscomposer dump-autoloadso your global functions are immediately available.
Service
ServiceResult standardizes your service responses:
Smart Generation: Combining
--method=processwith--makeableautomatically injectsprotected string $makeableMethod = 'process'soCommentService::run()dispatches to the right method instantly.
Trait
Traits do not receive automatic suffixes (unlike Actions, Services, etc.). So
structura:trait LoggablegeneratesLoggable.php, notLoggableTrait.php.
βοΈ Default Configuration (config/structura.php)
After publishing, you can set package-wide defaults in config/structura.php:
CLI flags always override config defaults.
π§± Example Structure
π License
Released under the MIT License.