- What is rekalogika/mapper used for in Laravel applications?
- It is a PHP object mapper for converting one object into another, most commonly an entity into a DTO and back. In Laravel apps it can reduce hand-written hydrators and simplify API resource or domain-to-DTO transformations. The package uses attribute-driven mapping rules and supports nested objects and circular references. It is not a Laravel-native package, so you typically wrap it in an application-level mapping service.
- How do I install rekalogika/mapper in a Laravel project?
- Install it with Composer using composer require rekalogika/mapper. Before adopting it, check that your Laravel app's locked Symfony component versions satisfy the package constraints. Because there is no evidenced Laravel service provider, register your own container binding or mapping service. Then write a small mapping test for one entity-to-DTO flow before rolling it out.
- Does rekalogika/mapper support Laravel 11 and Laravel 12?
- The package does not publish Laravel-specific version support in the provided release notes, so support depends on your app's PHP and Symfony component constraints. Laravel versions that resolve Symfony 7 components are more likely to align with v3.0.0, while apps locked to Symfony 6 should not adopt v3 without upgrading. Build a compatibility matrix and run Composer checks for your exact Laravel, PHP, and Symfony versions.
- Is there a Laravel service provider for rekalogika/mapper?
- There is no Laravel service provider or container binding evidenced in the release notes or package description. You should plan to create an internal service provider or binding that configures the mapper for your application. Keeping Laravel code behind that abstraction also reduces direct dependency on package APIs. This makes future upgrades and testing easier.
- How does rekalogika/mapper handle nested objects and circular references?
- The mapper is designed for object-to-object conversion and supports nested objects and circular references through attribute-driven mapping rules. That makes it suitable for transforming entities with relationships into DTOs without writing every assignment manually. You should still test representative object graphs, especially cyclic relationships, to confirm the configured rules match your domain. Keep mapping definitions explicit and covered by tests.
- What Symfony versions does rekalogika/mapper v3.0.0 require?
- Version 3.0.0 allows Symfony 8.x components except symfony/property-info, which remains pinned to 7.x. It also drops Symfony 6.x support, making it a breaking dependency change for apps still on Symfony 6 components. Full Symfony 8 compatibility is therefore partial, with an interface change planned for the next major version. Validate your locked component set with Composer before upgrading.
- Will upgrading rekalogika/mapper to v3 break my Laravel app?
- It can, especially if your Laravel app is still locked to Symfony 6 components or requires symfony/property-info 8.x. The v3 release is primarily a compatibility release, but dropping Symfony 6 is a breaking dependency change. The hash change from xxh64 to xxh128 may also invalidate persisted proxies or cache-derived identifiers. Branch the upgrade, run composer why-not checks, clear caches, and rerun mapping tests.
- Can I use rekalogika/mapper without the full Symfony framework?
- The provided notes describe a PHP object mapper with Symfony-oriented dependencies rather than a full Symfony framework requirement. It can be used as a Composer library behind an application-level mapping service, but it may rely on selected Symfony components such as property-info. Confirm whether symfony/property-info is required for your mapping use cases. Test a minimal installation before assuming it works without Symfony components.
- How should I test rekalogika/mapper mappings in a Laravel app?
- Write focused tests for each entity-to-DTO and DTO-to-entity mapping, including nested and circular relationships. Run static analysis and integration tests after Composer updates because dependency bumps, especially reflection-docblock changes, can affect docblock-based metadata parsing. Clear generated proxies or caches before rerunning tests if you upgraded across the hash change. A canary workload can then monitor mapping errors in production.
- Is rekalogika/mapper actively maintained and production-ready?
- The package shows active maintenance signals such as tests, static analysis, dependency bumps, and a deliberate interim release. Support is likely community and GitHub based rather than a vendor SLA, and Laravel-specific support is not evidenced. Production readiness depends on your compatibility matrix, cache behavior, and whether you can own integration and upgrades internally. Pilot it in one bounded context before adopting it across the application.