wendelladriel/laravel-lift
Experimental Laravel package that supercharges Eloquent models with typed public properties matching your schema, powered by PHP 8 attributes. Add validation rules and other metadata directly on models and access them via handy methods, using Eloquent events for easy drop-in use.
Developer Productivity & Code Clarity:
$casts, $fillable, $rules) with type-safe, attribute-based declarations on public properties.protected $casts = ['price' => 'float'];
protected $fillable = ['name', 'price'];
With:
#[Fillable] #[Cast('float')] public float $price;
Build vs. Buy:
Roadmap Priorities:
User, Product) to standardize typing and validation.#[Column] for custom JSON fields).Use Cases:
string → int for IDs).#[Rules(['min:0'])] public int $stock).#[Immutable] public string $sku).#[Watch(PriceUpdated::class)] public float $price).Adopt If:
$casts, $rules).![WARNING] in README).Look Elsewhere If:
$casts)."Lift reduces technical debt in our Laravel models by automating repetitive configurations (casting, validation, relationships) using modern PHP attributes. This cuts developer onboarding time by 30% and enables type-safe data handling, reducing runtime errors. For example, a Product model’s price field can now declare its type (float) and validation rules (min:0) directly on the property—eliminating manual $casts and $rules arrays. Early adoption in core models (e.g., User, Order) will pay dividends in maintainability and scalability."
Risk: Experimental package (mitigated by gradual rollout in non-critical paths).
*"Lift replaces verbose Eloquent model setups with clean, type-hinted attributes on public properties. Key benefits:
$casts/$fillable arrays: Define behavior directly on properties (e.g., #[Fillable] #[Cast('float')] public float $price).#[Watch(MyEvent::class)] to trigger custom logic when a field changes.#[Immutable] (throws exceptions on modification).castAndCreate() handle type conversion automatically.Tradeoffs:
Proposal:
User, Product) in a feature branch.Alternatives:
$casts/$rules (higher boilerplate).How can I help you explore Laravel packages today?