dflydev / dflydev-dot-access-data

Given a deep data structure representing a configuration, access configuration by dot notation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for numeric indexes and possibly objects?

alex-barylski opened this issue · comments

Any chance this is on your radar? It may sound obscure if this was only ever to be intended as a dot notation interface to YAML files, but in the case of some PHP applications when dealing with their insane structured arrays - I think something like dot notation would be a nice utility.

Just a thought. :)

I'm not the primary maintainer here but I have a couple of thoughts on this question.

Symfony's PropertyAccess component has all of that functionality and works really well in those scenarios. I see this dot-access-data library as more of a lightweight alternative that specializes in nested associative arrays, especially those used for configuration purposes.

It might be possible to support numeric indexes without too much trouble, but I don't think object properties would be feasible since that's a very deep rabbit hole to go down.

Just my $0.02 :)

I've added tests in PR #34 confirming that non-associative arrays can have their values accessed using numeric key paths.

I recommend closing this issue as "resolved" once #34 is merged as I believe that supporting dot access to object properties is beyond the scope of this library.