File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,7 +14,35 @@ composer require best/dot-notation
1414
1515This package has a single class with static methods, ` \Best\DotNotation ` .
1616
17- These methods all take an array as their first argument, and most then a "key path" as their
17+ There are two main groups of methods: those that operate recursively
18+ across an entire array, and those that get/set values from such arrays.
19+
20+ ### Recursive methods
21+
22+ For the recursive methods, you can use ` expand ` and ` compact ` methods to convert
23+ the dots from the expanded form and the compact form, and these operations are
24+ inverses of each other:
25+
26+ ``` php
27+ use Best\DotNotation;
28+
29+ $array = DotNotation::compact(array(
30+ 'my' => array(
31+ 'dotted' ==> array(
32+ 'key' => 'value'
33+ )
34+ )
35+ ));
36+ // returns the dotted array:
37+ array('my.dotted.key' => 'value');
38+
39+ // convert back to the other form:
40+ $original = DotNotation::expand(['my.dotted.key' => 'value']);
41+ ```
42+
43+ ### Get/set values
44+
45+ For the other methods, pass an array as their first argument, and most then a "key path" as their
1846second argument, that determines which keys on the array to operate on.
1947
2048The key path can include dots to indicate subkeys of arrays to access.
You can’t perform that action at this time.
0 commit comments