Foundation package providing base components, utilities, and contracts for all Laravilt packages. Build custom components with reusable traits, utilities, and base classes.
- ๐๏ธ Base Component - Foundation for all UI components
- ๐จ Concerns - 11+ reusable component behaviors (traits)
- ๐ ๏ธ Utilities - Get, Set, Str, Arr helpers
- ๐ Contracts - Interfaces for consistent implementations
- ๐ Serialization - Multi-platform support
| Trait | Description |
|---|---|
CanBeDisabled |
Enable/disable component state |
CanBeHidden |
Conditional visibility control |
HasActions |
Action button support |
HasColor |
Color theming (primary, success, danger, etc.) |
HasDescription |
Description/helper text |
HasIcon |
Icon display support |
HasId |
Unique identifier management |
HasLabel |
Label configuration |
HasName |
Name attribute handling |
HasPlaceholder |
Placeholder text |
InteractsWithState |
State management utilities |
use Laravilt\Support\Component;
use Laravilt\Support\Concerns\HasLabel;
use Laravilt\Support\Concerns\HasIcon;
use Laravilt\Support\Concerns\HasColor;
class MyComponent extends Component
{
use HasLabel;
use HasIcon;
use HasColor;
public static function make(string $name): static
{
return app(static::class, ['name' => $name]);
}
}
// Usage
MyComponent::make('action')
->label('Click Me')
->icon('plus')
->color('primary');use Laravilt\Support\Get;
use Laravilt\Support\Set;
use Laravilt\Support\Str;
// Dot notation access
Get::value($array, 'nested.key', 'default');
Set::value($array, 'nested.key', 'value');
// String utilities
Str::slug('My Component'); // 'my-component'composer require laravilt/supportphp artisan make:component RatingInput- Complete Documentation - Base components, concerns, utilities
- MCP Server Guide - AI agent integration
The MIT License (MIT). Please see License File for more information.
