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

Php Dot Array Laravel Package

pharaonic/php-dot-array

Pharaonic PHP Dot Array gives you clean dot-notation access to nested arrays: get, set, has, and forget values like config('app.name') for any array. Lightweight, framework-agnostic, and easy to drop into Laravel or plain PHP projects.

Deep Wiki
Context7

pharaonic/php-dot-array is a lightweight, dependency-free PHP utility for working with deeply nested arrays using simple dot notation. Instead of chaining isset() checks and array references, you read, write, and remove values with paths like config.database.host.

  • Get, set, and delete nested values via dot-key paths
  • Default values returned whenever a key is missing
  • has checks key existence without notices
  • Wildcard support for bulk operations
  • Works with plain PHP arrays — no framework required
Frequently asked questions about Php Dot Array
How do I install pharaonic/php-dot-array in a Laravel project?
Install it with Composer using composer require pharaonic/php-dot-array. It has no service provider, config file, migrations, or publishable assets, so there is no additional Laravel bootstrapping. Confirm the PHP version constraint and autoloading in the package metadata before committing it to your composer.json.
Does pharaonic/php-dot-array replace Laravel's Arr::get, Arr::set, and data_get helpers?
Not automatically. Laravel already provides dot-notation access through Illuminate\Support\Arr and the data_get, data_set, and data_fill helpers, including wildcard checks in Arr::has. Adopt this package only if you need documented wildcard write/delete behavior, stricter typing or exception semantics, or the same API outside Laravel where pulling in illuminate/support is undesirable. Otherwise it risks being a duplicate array helper.
Can I use pharaonic/php-dot-array outside Laravel?
Yes, the package is described as a framework-agnostic PHP utility with no Laravel coupling. That makes it a reasonable candidate for CLI tools, SDKs, legacy PHP apps, or package internals that must not depend on illuminate/support. You still need to verify its PHP version constraint and PSR-4 autoloading from the repository.
Does pharaonic/php-dot-array support wildcards for set and delete operations?
The overview says it supports optional wildcard matching for bulk operations, but the exact semantics for set and delete are not documented in the provided material. You should confirm from the README and tests whether delete('a.*.b') removes every matching b under a, how partially populated nodes are handled, and whether set supports wildcards at all. Treat wildcard writes and deletes as behavior to test explicitly before production use.
How does pharaonic/php-dot-array handle array keys that contain literal dots?
Dot notation inherently collides with keys that legitimately contain dots, such as config keys, JSON payload field names, or Elasticsearch-style keys. The provided context does not document an escape syntax or alternative accessor for literal dotted keys. Before adoption, add test cases for your real payload shapes and confirm whether the package offers escaping or whether you must avoid dotted keys.
Is pharaonic/php-dot-array actively maintained and safe to depend on?
The package is very small, with roughly 10 stars and an unknown repository in the metadata, so it is effectively a single-maintainer dependency with little community backstop. The surface area is small enough to vendor or fork if it lapses, which limits the downside but also limits strategic value. Reconcile the recorded release date against Packagist and the actual tag history, and review maintainer identity, CI, and test coverage before sign-off.
What PHP versions does pharaonic/php-dot-array support?
The PHP version constraint is not stated in the provided overview. The assessment flags PHP 8.1 through 8.4 support and PSR-4 autoload correctness as items to confirm from composer.json and the source. Check the package's composer.json before installing it in a Laravel application with a fixed PHP platform requirement.
What happens when I get a missing path with pharaonic/php-dot-array?
The provided context does not specify whether missing paths return null, a supplied default, or throw an exception, nor whether the API is static-only or instance-based. Those details matter for error handling and for parity with Laravel's data_get, which accepts a default. Confirm the behavior from the README or a quick test before relying on it.
Is there a test suite or CI for pharaonic/php-dot-array?
The repository is listed as unknown in the metadata, so test coverage, CI status, and static analysis such as PHPStan or Psalm cannot be verified from the record alone. The assessment treats this as a supply-chain vetting blocker rather than an architectural blocker. Ask for or inspect the test suite and CI configuration before adopting the package in a production Laravel codebase.
What are alternatives to pharaonic/php-dot-array for dot-notation array access?
In Laravel, use Illuminate\Support\Arr::get, Arr::set, Arr::has, Arr::forget, and the data_get/data_set helpers, which already cover dot-notation reads and writes. Outside Laravel, you can implement a small internal helper or choose a maintained dot-notation package, since this utility is only about 200 lines and easy to vendor. The main decision is whether you need wildcard write/delete semantics that Laravel's helpers do not provide.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console