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.
    • Enables self-documenting models where business logic (e.g., validation, casting) is co-located with data definitions.
    • Example: Replace:
      protected $casts = ['price' => 'float'];
      protected $fillable = ['name', 'price'];
      
      With:
      #[Fillable] #[Cast('float')] public float $price;
      
  • Build vs. Buy:

    • Buy: Avoid reinventing wheel for model attribute management (e.g., custom traits, macros, or event listeners).
    • Build: Justify only if needing highly specialized behavior (e.g., dynamic attribute generation at runtime).
  • Roadmap Priorities:

    • Phase 1: Adopt for core domain models (e.g., User, Product) to standardize typing and validation.
    • Phase 2: Extend to API resources or serialization layers (e.g., via #[Column] for custom JSON fields).
    • Phase 3: Explore immutable models for audit trails or event sourcing.
  • Use Cases:

    • Type Safety: Eliminate runtime casting errors (e.g., stringint for IDs).
    • Validation: Enforce rules at property level (e.g., #[Rules(['min:0'])] public int $stock).
    • Immutable Data: Protect critical fields (e.g., #[Immutable] public string $sku).
    • Event-Driven Architecture: Trigger custom events per property (e.g., #[Watch(PriceUpdated::class)] public float $price).

When to Consider This Package

  • Adopt If:

    • Your team struggles with boilerplate in Eloquent models (e.g., $casts, $rules).
    • You prioritize type safety and IDE support (e.g., PHPStorm autocompletion for properties).
    • You need fine-grained control over model behavior (e.g., per-property events, immutability).
    • Your Laravel version is 8.83+ (check supported versions).
    • You’re okay with experimental status (see ![WARNING] in README).
  • Look Elsewhere If:

    • You need production-ready stability (low stars, experimental label).
    • Your models are simple (e.g., no custom casting/validation).
    • You’re using Laravel 9+ features that conflict with Lift’s internals (e.g., custom accessors/mutators).
    • You prefer declarative over attribute-based approaches (e.g., Laravel’s built-in $casts).
    • Your team lacks PHP 8.1+ (required for attributes).

How to Pitch It (Stakeholders)

For Executives:

"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).


For Engineers:

*"Lift replaces verbose Eloquent model setups with clean, type-hinted attributes on public properties. Key benefits:

  • No more $casts/$fillable arrays: Define behavior directly on properties (e.g., #[Fillable] #[Cast('float')] public float $price).
  • Per-property events: Use #[Watch(MyEvent::class)] to trigger custom logic when a field changes.
  • Immutable fields: Protect critical data with #[Immutable] (throws exceptions on modification).
  • Seamless casting: Methods like castAndCreate() handle type conversion automatically.

Tradeoffs:

  • Experimental: Not production-tested at scale (start with non-critical models).
  • Learning curve: Requires PHP 8.1+ attributes (but pays off long-term).

Proposal:

  1. Pilot: Apply to 2–3 core models (e.g., User, Product) in a feature branch.
  2. Measure: Track dev time saved and error rates.
  3. Expand: Roll out to API resources if successful.

Alternatives:

  • Stick with manual $casts/$rules (higher boilerplate).
  • Build a custom trait (higher maintenance)."*
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony