Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Lift Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Developer Productivity & Code Clarity:

    • Replace verbose Eloquent model configurations (e.g., $casts, $fillable, $rules) with type-safe, attribute-based declarations on public properties.
    • Enable strong typing for model properties (e.g., public string $name), reducing runtime errors and improving IDE support (autocompletion, refactoring).
    • Reduce boilerplate: Eliminate manual $fillable, $casts, and $rules arrays by defining them directly on properties (e.g., #[Fillable] #[Rules(['required'])] public string $name).
  • Architectural Flexibility:

    • Build vs. Buy Decision: Justify adopting this package over custom solutions or libraries like Laravel Model Casting or Spatie’s Laravel Attributes by highlighting its native integration with Eloquent, experimental but promising feature set, and MIT license (low risk).
    • Roadmap Alignment: Prioritize for projects where:
      • Teams are adopting PHP 8+ (required for attributes).
      • Models are complex (e.g., e-commerce Product, SaaS Subscription) with many relationships, casts, or validation rules.
      • Immutability or fine-grained property events (@Watch) are needed (e.g., audit logs, real-time updates).
  • Use Cases:

    • Data Integrity: Enforce types and validation at the property level (e.g., #[Cast('float')] public float $price).
    • Immutable Models: Protect critical fields (e.g., #[Immutable] public string $sku) from accidental updates.
    • Custom Relationships: Define relationships via attributes (e.g., #[BelongsTo(User::class)]) for consistency with property-based configurations.
    • Event-Driven Workflows: Trigger events when specific properties change (e.g., #[Watch(PriceUpdated::class)] public float $price).
    • Multi-Tenant or Custom DB Setups: Configure connection/table names per model (e.g., #[DB(connection: 'tenant_1')]).
  • Team Scalability:

    • Onboarding: Reduce cognitive load for new developers by making model behavior self-documenting (attributes > magic methods).
    • Refactoring: Safer changes due to compile-time type checks and explicit property configurations.

When to Consider This Package

  • Adopt When:

    • Your team is comfortable with experimental packages (marked as "experimental" in the README).
    • You’re using Laravel 9+ (PHP 8+ attributes support) and want to modernize model definitions.
    • You need fine-grained control over model properties (e.g., per-property immutability, events, or casting) without bloating $fillable/$casts arrays.
    • Your project has complex models (e.g., 20+ properties with mixed types/validations) where attribute-based declarations would reduce noise.
    • You’re building a greenfield project or can dedicate time to migrate existing models incrementally.
  • Look Elsewhere If:

    • You need production-ready stability: This package is experimental (last release in 2026, but no major dependents yet).
    • Your team lacks PHP 8+ or Laravel 9+ (attributes require PHP 8.0+).
    • You prefer minimalism: For simple CRUD apps, Eloquent’s built-in features may suffice.
    • You require enterprise support: No official backing or commercial maintenance (MIT license = community-driven).
    • Your models are highly dynamic (e.g., generated via migrations or ORM tools like Laravel Nova or Filament).
  • Alternatives to Evaluate:

    • Spatie’s Laravel Attributes: More mature, but focused on general attributes (not Eloquent-specific).
    • Custom Trait Solutions: For teams wary of experimental packages, build a lightweight trait system.
    • Laravel Scout/Nova Extensions: If using Laravel’s ecosystem tools, check for native integrations.

How to Pitch It (Stakeholders)

For Executives:

*"Lift is a game-changer for how we define Laravel models. Today, our Eloquent models are cluttered with $fillable, $casts, and $rules arrays—making them hard to read, maintain, and type-check. This package lets us declare model behavior directly on properties using PHP 8 attributes (e.g., #[Fillable] #[Rules(['required'])] public string $name), which:

  • Reduces bugs by enforcing types and validation at the property level.
  • Speeds up development by cutting boilerplate (e.g., no more manual $casts arrays).
  • Future-proofs our code with features like immutable fields and property-specific events (e.g., trigger alerts when price changes). It’s experimental but aligns with our tech stack (PHP 8+/Laravel 9+). We’d pilot it on our Product and Subscription models to validate the ROI in developer productivity and code quality."*

For Engineers:

*"Lift replaces Eloquent’s verbose model configurations with type-safe, attribute-based declarations. Here’s why it’s worth trying:

  • No More $fillable/$casts Arrays: Define rules, casts, and relationships directly on properties (e.g., #[Fillable] #[Cast('float')] public float $price).
  • Strong Typing: IDE support for autocompletion and refactoring (e.g., public string $name).
  • Experimental but Powerful Features:
    • Immutable properties: Prevent accidental updates to critical fields (e.g., #[Immutable] public string $sku).
    • Property-specific events: Trigger custom events when a field changes (e.g., #[Watch(PriceUpdated::class)]).
    • Relationships as attributes: Define BelongsTo, HasMany, etc., without methods (e.g., #[BelongsTo(User::class)]).
  • Migration Path: Start with a single model (e.g., Product) and expand incrementally. Risk: It’s experimental, but the payoff in cleaner, safer models is worth the pilot. Let’s test it on our Product model first."*

For Developers:

*"Imagine writing models like this:

final class Product {
    use Lift;

    #[Fillable] #[Rules(['required', 'string'])]
    public string $name;

    #[Cast('float')] #[Immutable]
    public float $price;

    #[BelongsTo(User::class)]
    public User $owner;
}

No more:

protected $fillable = ['name'];
protected $casts = ['price' => 'float'];
public function owner() { return $this->belongsTo(User::class); }

Benefits:

  • Type safety: public string $name ensures runtime consistency.
  • Less boilerplate: Attributes replace repetitive array definitions.
  • Cool features: Immutable fields, property events, and relationship attributes.
  • Future-proof: Built for Laravel’s evolution (e.g., PHP 8.2+ attributes). Downside: Experimental, but the docs are solid and the author is active. Let’s try it on User and Order models first."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai