opportus/object-mapper
Opportus ObjectMapper is a PHP library for mapping data between objects and arrays with configurable strategies. It helps transform DTOs and entities cleanly, reducing repetitive boilerplate in Laravel and plain PHP projects.
fromArray() helpers.Adopt only if all of the following hold:
Look elsewhere — likely the default — if any of these apply:
spatie/laravel-data covers DTO + validation + mapping with active maintenance; cuyz/valinor covers typed hydration with strong error messages; Symfony Serializer's ObjectNormalizer covers the generic case; mark-gerarts/automapper-plus covers the AutoMapper-style strategy pattern.Executives: We evaluated a third-party object-mapping library and recommend against adoption. It is MIT-licensed and free, but it has negligible community adoption and no releases since 2022, so it would become an unmaintained dependency sitting in our request path. Declining costs nothing and removes a future forced migration; the alternative — a small in-house mapping layer or an actively maintained library — is low-effort and keeps our upgrade path clean. No procurement, no licensing review, no new vendor.
Engineering: The package's core idea — separating mapping strategy from explicit per-field controls — is worth borrowing even though the package isn't. It's a reasonable reference for the interface design of a thin, owned mapping layer at the DTO boundary. Do not take it as a runtime dependency without a named owner, a fork-and-patch plan, and a test matrix against our current PHP/Laravel versions. Preferred stack: spatie/laravel-data where DTOs and validation overlap, cuyz/valinor for typed hydration, hand-rolled in between.
How can I help you explore Laravel packages today?