laminas/laminas-hydrator
Laminas Hydrator provides flexible strategies to hydrate and extract data between objects and arrays. Supports reflection, class methods, naming strategies, and custom hydrators, making it easy to map entities, DTOs, and forms cleanly across your application.
Architecture fit:
The package (laminas-hydrator) remains a well-structured, standalone component adhering to clean architecture principles, with clear interfaces for data transformation. Its decoupled design aligns with Laravel’s service container and dependency injection patterns, though direct integration with Eloquent requires explicit bridging. The package’s focus on hydration/dehydration logic makes it a strong candidate for projects needing flexible object mapping, particularly those leveraging DTOs or API payloads.
Integration feasibility: Composer-based installation remains seamless, but Laravel-specific compatibility now requires explicit validation due to:
CONDITION_OR/AND, HydratorProviderInterface), which may conflict with Laravel’s built-in hydration strategies (e.g., Eloquent’s Arrayable).composer show).Technical risk:
ServiceProvider bootstrapping to override default behaviors.HydratorInterface) are misaligned with Laravel’s ORM expectations (e.g., mass assignment rules).spatie/array-to-object) or stabilizes its roadmap.Key questions:
CONDITION_OR/AND, HydratorProviderInterface) map to Laravel’s alternatives (e.g., Eloquent’s accessors/mutators)?composer about) and the roadmap for 5.0.x?Stack fit:
laminas-hydrator with Eloquent. For example:
HydratorInterface to transform API payloads into DTOs before Eloquent hydration.fill() or toArray() with hydrator logic via traits/mixins.laminas-service-manager).Migration path:
CONDITION_OR/AND).Str::contains() for condition checks).Model::hydrate() or API resource serialization.Compatibility:
laminas-hydrator; use explicit binding in AppServiceProvider.laminas/laminas-stdlib or other Laminas packages.Sequencing:
Maintenance:
CONDITION_OR/AND in 5.0.x.Support:
HydratorInterface vs. Eloquent’s Arrayable).Scaling:
Failure modes:
spatie/array-to-object or similar may be needed.Ramp-up:
How can I help you explore Laravel packages today?