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
Array Dot Notation

Array Dot Notation Laravel Package

sajadsdi/array-dot-notation

Lightweight, high-performance PHP helper to get, set, delete, and check nested array values using dot notation. Supports multi-key operations, default values, key mapping on output, and callbacks for get/set behavior.

View on GitHub
Deep Wiki
Context7

Set and Get with dot notation in arrays (PHP)

Frequently asked questions about Array Dot Notation
How do I install this package in a Laravel project?
Run `composer require sajadsdi/array-dot-notation` in your project root. The package is dependency-free and integrates instantly with Laravel’s array ecosystem. No configuration or service provider setup is required.
Does this work with Laravel’s built-in `Arr::dot()` helper?
Yes, but this package offers a standalone alternative with simpler syntax (e.g., `ArrayDot::set($array, 'a.b', 'value')`). Use it when you need pre-Laravel 5.5 compatibility or prefer a lighter-weight solution without Laravel’s dependencies.
Can I use dot notation to modify deeply nested arrays in Laravel configs?
Absolutely. The package supports `set()`, `get()`, and `delete()` operations on nested arrays, making it ideal for Laravel’s `config()` array or `.env`-parsed configurations. Example: `$dotNotation->set('app.debug', true);` updates nested config values.
Is this package safe for production use in high-traffic Laravel apps?
Yes, it’s optimized for performance with minimal overhead. Benchmark tests show it handles thousands of dot-notation operations per second, making it suitable for APIs, caching layers, or request payload processing in production.
How does this handle edge cases like circular references or invalid dot notation (e.g., `a..b`)?
The package doesn’t validate dot notation syntax (e.g., `a..b` or `a[b]`), which could cause errors. For strict validation, pre-process keys or use Laravel’s `Arr::dot()` alongside it. Circular references may cause infinite loops—test thoroughly in your environment.
Can I use this to flatten/unflatten arrays for API requests or form data?
Yes. Use `get()` to extract nested values (e.g., `$dotNotation->get('user.address.city')`) or `set()` to update arrays dynamically. It’s perfect for transforming request payloads or form submissions into dot-notation-friendly structures.
Does this support default values or callbacks for missing keys?
Yes. The `get()` method accepts default values (e.g., `$dotNotation->get('user.profile.name', 'Guest')`) and callbacks to conditionally return defaults. Example: `$dotNotation->get('user.profile.name', fn() => 'Anonymous')`.
How does this compare to `spatie/array-to-object` for Laravel?
This package focuses solely on dot-notation array manipulation, while `spatie/array-to-object` converts arrays to objects. Use this for lightweight array operations (e.g., configs, requests) and `spatie/array-to-object` if you need object-oriented access.
Can I make array operations immutable (e.g., return new arrays instead of modifying in-place)?
No, the package modifies arrays in-place by default. To enforce immutability, wrap operations in `array_merge()` or use `json_decode(json_encode($array), true)` to clone the array before modifications.
What Laravel versions does this package support, and are there any breaking changes?
The package is PHP 7.4+ compatible and works with all Laravel versions (5.5+). It’s a standalone utility with no Laravel-specific dependencies, so version updates are risk-free. Check the [GitHub releases](https://github.com/sajadsdi/array-dot-notation/releases) for breaking changes.
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor