Weave 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 Object Mapper Laravel Package

shureban/laravel-object-mapper

Laravel object mapper maps JSON strings, arrays, and FormRequest data into typed PHP objects (DTOs) using reflection. Use inheritance, a trait, or ObjectMapper directly; supports readonly DTOs and static constructors. Works out of the box via auto-discovery.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit The laravel-object-mapper package has advanced from v1.2.0 to v2.0.1, a major version release spanning v2.0.0 (breaking) and a v2.0.1 patch. The core value proposition is unchanged: snake_case ↔ camelCase transformation for Laravel applications (API responses, DTOs, Eloquent transformations). The headline change in v2.0.1 is Laravel 13 support (PR #12), signalling the package is actively tracking the Laravel release train. The jump from ^1.2.0 to ^2.0.1 implies the v2.0.0 release introduced breaking changes (not enumerated in the v2.0.1 release notes) that must be reviewed before adopting. Architecturally the fit remains strong — the package still lives in Laravel's service container/facade model — but the v2 API surface should be validated against existing call sites (e.g., ObjectMapper::toCamel(), ObjectMapper::transform(), ObjectMapper::ignore()).

Integration Feasibility Integration remains feasible, but the v1 → v2 upgrade is no longer a drop-in. Because only the v2.0.1 patch notes are provided (Laravel 13 support), the v2.0.0 changelog must be retrieved to identify renamed methods, changed defaults, or dropped config keys. Laravel 13 compatibility is a positive signal for teams on the latest LTS trajectory, but it may also mean v2 drops older Laravel versions (previously cited LTS targets of 8.x/9.x/10.x). Confirmation of the supported Laravel/PHP matrix is required before committing.

Technical Risk

  • Medium (upgraded from Low): The 1.x → 2.x boundary is a major version bump and therefore carries implicit breaking-change risk. The v2.0.1 patch notes do not enumerate them.
  • Version Constraint Drift: If v2 drops Laravel 8.x/9.x/10.x support, applications on older LTS lines cannot adopt v2.0.1 without also upgrading Laravel — a significant hidden coupling.
  • Dependencies: Re-verify PHP version floor (v2 likely targets PHP 8.1+). Cross-check spatie/array-to-object and other overlapping transformation utilities.
  • Performance: Unchanged in scope; still lightweight but bulk mapping (10k+ records) should be benchmarked as before.
  • Positive: Active maintenance (Laravel 13 support landed quickly) reduces abandonment risk relative to the v1.2.0-era assessment.

Key Questions

  1. What are the breaking changes introduced in v2.0.0 (methods, signatures, config keys, defaults)?
  2. What is the full supported Laravel/PHP compatibility matrix for v2.0.1 — does it drop any LTS versions currently in use?
  3. Does Laravel 13 support imply v2 is forward-looking only, requiring a Laravel upgrade to adopt?
  4. What are the migration steps from v1.2.0 → v2.0.1 (upgrade guide, codemods, deprecations)?
  5. Are there behavioral changes to toCamel()/toSnake()/transform() edge cases (nested arrays, nulls, special characters)?
  6. Do existing DTO mappers (php-ddd/ddd-framework) or API resources (spatie/laravel-api-resources) remain compatible with the v2 API?

Integration Approach

Stack Fit

  • Laravel Core: Native integration via service container and facade is retained (assuming v2 does not rename the facade — verify).
  • Laravel Versions: v2.0.1 explicitly adds Laravel 13 support. Confirm the full support window (previously v1.2.0 targeted 8.x/9.x/10.x); v2 may narrow to modern LTS versions.
  • PHP Versions: Re-verify minimum PHP version for v2 (likely PHP 8.1+); update CI matrix accordingly.
  • Composer: Install as composer require shureban/laravel-object-mapper:^2.0.1. Existing installs on ^1.2.0 must be treated as a major upgrade, not a patch bump.

Migration Path

  1. Discovery: Retrieve the v2.0.0 changelog and migration guide. Identify every breaking change before planning.
  2. Audit: Grep the codebase for all ObjectMapper::* call sites and config keys; flag any usage of deprecated/removed APIs.
  3. Evaluation: Stand up a branch in staging, upgrade to ^2.0.1, and run the full transformation test suite (including edge cases from v1).
  4. Incremental Cutover:
    • New code paths adopt v2 API (ObjectMapper::toCamel() / toSnake() as renamed or retained).
    • Existing paths are migrated in a series of small PRs, not a big-bang rewrite.
  5. Rollback Guard: Keep v1.2.0 pinned in composer.json until v2 is proven in staging; use a feature-flagged adapter class wrapping ObjectMapper so the swap is reversible.

Compatibility

  • Laravel Versions: Verify v2.0.1's compatibility table. Laravel 13 is confirmed; check whether 8.x/9.x/10.x were dropped.
  • PHP Versions: Confirm floor (8.1 vs 8.0).
  • Conflicts: Re-audit spatie/laravel-array-to-object and other array-to-object utilities; API changes in v2 may widen the overlap surface.
  • Database: No direct impact; snake_case column assumptions unchanged.

Sequencing

  1. Phase 1: Pull v2.0.0 + v2.0.1 changelogs; document breaking changes and upgrade steps.
  2. Phase 2: Feature-flag an internal MapperAdapter around ObjectMapper calls to isolate the upgrade.
  3. Phase 3: Upgrade a non-critical service (API controllers / internal tools) to ^2.0.1; observe in staging.
  4. Phase 4: Roll forward to critical paths (form requests, queue jobs, third-party integrations) once Phase 3 is clean.
  5. Phase 5: Re-establish unit + integration tests covering edge cases; lock version to ^2.0.1 on success.

Operational Impact

Maintenance

  • Proactive: Monitor GitHub releases. The team's responsiveness (Laravel 13 support shipped) is a strength — but expect more frequent majors as the Laravel cadence accelerates.
  • Deprecations: v2.0.0 breaking changes are the immediate concern. Track any v1 APIs that are now deprecated/removed and schedule migration.
  • Version Pinning: Pin to ^2.0.1 (not ^2.0.0) to avoid known v2.0.0 issues. Consider ~2.0.1 in conservative services.
  • Custom Logic: Any custom transformers built atop v1 internals must be re-validated against v2.

Support

  • Community: GitHub issues/discussions remain the primary channel.
  • Fallback: Retain a manual transformation utility (Str::camel(), custom mappers) as a rollback path for critical paths until v2 is proven.
  • Logging: Wrap ObjectMapper::transform() in try/catch; log failures with payload shape (not contents) to diagnose edge cases.
  • Migration Documentation: Create an internal runbook specifically for the v1 → v2 upgrade, capturing any gaps in the upstream changelog.

Scaling

  • Performance: No evidence of performance regression, but re-run bulk benchmarks (10k+ records) on v2 to confirm parity with v1.2.0.
  • Caching: Unchanged strategy — cache transformed API payloads where transformations are hot paths.
  • Horizontal Scaling: No impact.

Failure Modes

Scenario Mitigation Strategy
v2.0.0 breaking changes break existing calls Retrieve v2.0.0 changelog; grep/gate all ObjectMapper::* call sites behind an adapter.
v2 drops Laravel 8/9/10 LTS support Confirm compatibility matrix before upgrading; defer v2 adoption if on older LTS.
PHP version floor raised in v2 Validate CI matrix; use Docker/Sail for parallel PHP version testing.
Transformation behavior changes in edge cases (nested arrays, nulls) Port v1 test suite verbatim; add new edge-case tests for v2.
Package update breaks compatibility Pin to ^2.0.1; keep ^1.2.0 branch deployable for rollback.
Transformation errors in production Feature-flag swap via adapter class; revert flag if error rate spikes.

Ramp-Up

  • Documentation: Read the v2.0.0 migration notes and v2.0.1 release notes together. Update internal docs to reflect the v2 API surface.
  • Training: Onboarding session focused on:
    • What changed between v1 and v2 — enumerate every breaking change.
    • When to use toCamel() vs. toSnake() (unchanged conceptually).
    • Handling edge cases (nulls, nested arrays, special characters) — verify v2 behavior matches v1.
  • Examples: Update boilerplate snippets to the v2 API (verify method names against v2 source before publishing):
    // API Response Transformation (verify against v2 API)
    return ObjectMapper::toCamel($user->toArray());
    
    // Form Request Validation (verify against v2 API)
    $data = ObjectMapper::toCamel(request()->all());
    
  • Testing: Port all v1 integration tests to v2; add regression tests specifically targeting the deltas introduced in v2.0.0.
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.
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table