Skip to content

Feature Request: Support Objects #1

Description

@CraigChilds94

I think it would be great to also support Objects, being able to access nested properties on a stdObject

I'm not sure how one might manage this with strict typing, maybe a different implementation for each? DotObject, DotArray or in the constructor and get() you type check and use strict typed internal code.

Say you had an object like so:

$object = (object) ['foo' => ['bar' => 'baz']];

It would be nice to have the same logic and syntax as with arrays, and be interchangeable at each level, so an array nested in an object (like in the above example), or an object nested in an array.

$dot = new Codin\Dot($object);

$dot->get() // (object) ['foo' => ['bar' => 'baz']]
$dot->get('foo') // ['bar' => 'baz']
$dot->get('foo.bar') // 'baz'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions