Weave Code
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

Get In Laravel Package

igorw/get-in

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Simplification of Complex Data Access: Enables clean, expressive traversal of deeply nested arrays/objects (e.g., API responses, user profiles, or multi-level configurations) without repetitive isset() checks or manual path validation. Reduces cognitive load and improves maintainability.
    • Example: Replace spaghetti like if (isset($data['user']['preferences']['theme']['darkMode'])) with get_in($data, ['user', 'preferences', 'theme', 'darkMode'], false).
  • Acceleration of Feature Development: Speeds up implementation of data-heavy features (e.g., dynamic form builders, CMS content management, or analytics dashboards) by eliminating boilerplate traversal logic.
  • Build vs. Buy Decision: Avoids reinventing nested traversal logic, saving 30–50% development time compared to custom solutions. The package’s MIT license and zero dependencies make it a low-risk, high-reward choice.
  • Use Cases:
    • API Response Handling: Safely parse nested JSON/API payloads (e.g., Stripe, Shopify) with fallback defaults.
    • Configuration Management: Merge or validate nested config arrays (e.g., Laravel .env overrides, plugin settings) without manual checks.
    • Legacy System Modernization: Refactor spaghetti array_key_exists() chains into readable, functional traversal.
    • Testing: Simplify assertions in PHPUnit for complex data structures (e.g., assertEquals('expected', get_in($response, ['data', 'user', 'name']))).

When to Consider This Package

  • Adopt If:
    • Your team frequently works with nested arrays/objects (3+ levels deep) and wants to reduce boilerplate and improve readability.
    • You’re using Laravel or PHP and need a lightweight (~1KB), dependency-free solution for traversal.
    • Your codebase has repetitive traversal logic (e.g., data['user']['profile']['settings'] with manual null checks).
    • You prioritize developer experience over micro-optimizations (package adds minimal overhead).
    • You need functional-style updates (e.g., update_in) or deep path setting (e.g., assoc_in) beyond Laravel’s Arr::get().
  • Look Elsewhere If:
    • You require type safety (use spatie/data-transfer-object or PHP 8.1+ typed properties).
    • Your use case involves non-linear traversal (e.g., graph structures)—consider rubix/ml or custom logic.
    • You’re in a performance-critical path (e.g., real-time systems) where native PHP or array_reduce is preferred.
    • You need immutable data structures—pair with symfony/collections or league/immutable-persistent-array.
    • Your team resists functional programming paradigms; start with Laravel’s Arr methods instead.

How to Pitch It (Stakeholders)

For Executives:

"This package lets our developers traverse complex data structures—like user profiles, API responses, or nested configurations—with clean, readable code. Instead of writing 5+ lines of isset() checks to access a deeply nested setting, they’d use a single line like get_in($user, ['preferences', 'theme', 'darkMode'], false). It’s a low-cost, high-impact tool to reduce bugs, improve maintainability, and accelerate feature development. With no licensing fees or dependencies, it’s a no-brainer for teams handling nested data."

For Engineering:

*"igorw/get-in provides a Lodash-like _.get() for PHP, but with superpowers:

  • get_in: Traverse nested arrays/objects with fallbacks (e.g., get_in($data, ['a', 'b', 'c'], 'default')).
  • update_in: Modify values at any depth (e.g., update_in($data, ['a', 'b'], fn($x) => $x * 2)).
  • assoc_in: Set values deep in the structure (e.g., assoc_in($data, ['new', 'path'], 'value')). Why use it?
  • Reduces boilerplate: No more isset() spaghetti.
  • Laravel-friendly: Works with Eloquent, API responses, and config arrays.
  • Extensible: Supports custom resolvers or chaining. Try it for config management, API parsing, or any nested data workflow where you’re tired of writing manual traversal logic.*

Call to Action: "Let’s prototype this in [Module X] to replace our current traversal logic. It’ll make the codebase more maintainable and reduce onboarding time for new devs—with zero risk."


For Architects/Tech Leads: *"This package fills a gap in Laravel’s ecosystem by offering functional, deep traversal with defaults and updates. While Arr::get() handles simple cases, get_in excels for:

  • Complex fallbacks (e.g., get_in($user, ['profile', 'address'], ['city' => 'Unknown'])).
  • In-place updates (e.g., update_in($data, ['stats', 'views'], fn($v) => $v + 1)).
  • Dynamic paths (e.g., get_in($data, [$key, 'value'])). Integration is trivial (Composer install + 1 line of use), and the MIT license ensures no vendor lock-in. Start with a pilot in [high-traversal area] to validate gains."*
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.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle