- What Laravel versions does wendelladriel/laravel-lift support?
- The package officially supports Laravel 9+ and requires PHP 8+. Check the [Laravel Cloud badge](https://packagist.org/packages/wendelladriel/laravel-lift) for the latest compatibility details. It leverages PHP 8 attributes, so older Laravel versions won’t work.
- How do I migrate from traditional `$fillable` and `$casts` to Lift attributes?
- Replace protected properties like `$fillable` and `$casts` with PHP 8 attributes (e.g., `[Fillable]`, `[Cast]`). The package processes these attributes during model bootstrapping, so existing queries and relationships remain unchanged. Start with non-critical models to test stability.
- Can I use Lift alongside existing validation logic (e.g., Form Requests)?
- Yes, Lift integrates with Laravel’s validation pipeline. Attributes like `[Rules]` apply validation rules directly to properties, which will work seamlessly with Form Requests or API resources. No conflicts are expected if you’re using Laravel’s built-in validation.
- What happens if I encounter issues with the experimental package?
- Since this is experimental, revert to traditional Eloquent methods (e.g., `$fillable`, `$casts`) by removing the `Lift` trait and attributes. The package is designed to be non-intrusive, so your models will fall back to standard Eloquent behavior without breaking.
- Does Lift support immutable properties or domain-driven design (DDD) patterns?
- Yes, Lift includes support for immutable properties via attributes. You can mark properties as immutable to enforce DDD invariants or auditability. This is particularly useful for read models or event-sourced systems where data integrity is critical.
- Will using Lift impact performance in large-scale applications?
- Lift uses PHP attributes and reflection, which adds minimal overhead. For most applications, the impact is negligible. However, if you’re running high-frequency operations (e.g., API rate limits), benchmark with production-like data volumes to ensure performance meets expectations.
- Can I use Lift with existing Eloquent relationships (e.g., `belongsTo`, `hasMany`)?
- Absolutely. Lift is designed to work alongside standard Eloquent relationships. Relationship definitions remain unchanged, and Lift only modifies property-level behavior (e.g., casts, validation). Your existing queries and relationship logic will continue to function.
- How do I handle dynamic properties or inheritance with Lift?
- Lift is optimized for static, typed properties. Dynamic properties or complex inheritance scenarios may require additional logic. If you need dynamic behavior, consider using traditional Eloquent methods or hybrid approaches (e.g., attributes for static properties, methods for dynamic ones).
- Are there alternatives to Lift for typed Eloquent models?
- If you’re looking for alternatives, consider packages like `spatie/laravel-model-states` for stateful models or `laravel-shift/blueprint` for schema-driven models. However, Lift uniquely combines PHP 8 attributes with Eloquent events for fine-grained control, making it ideal for developers who prefer modern syntax.
- How do I test Lift in a production environment before full adoption?
- Start with a feature flag or config-based toggle to enable Lift only for specific models. Monitor logs and performance metrics during testing. Use a staging environment that mirrors production traffic to catch any edge cases before rolling out to all models.