Download the PHP package mediact/data-container without Composer
On this page you can find all versions of the php package mediact/data-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package data-container
Abandoned
This package is abandoned. To select data based on a pattern we recommend using JMESPath. To find paths that match a pattern (glob) and to update those paths (set) we don't have a clear alternative.
Data Container
This package provides a data container. A data container can contain any data. The data can be accessed using dot-notation.
Installation
Usage
Creating a container
A container can be created directly or using a factory.
Checking whether a value has been set with has()
Getting a value with get()
Setting a value with set()
Removing a value with remove()
The remove method also supports wildcards, for example remove('bar.*')
;
Getting paths that match a pattern with glob()
The glob method returns a list of paths that match the given pattern.
Getting paths and their replacements with expand()
The expand method returns a list of paths that match the given pattern and also returns their replacements. The replacement can contain variables in a similar way as preg_replace.
Getting branches that match a pattern with branch()
The branch method returns the paths that are matched by a pattern as a list of data containers.
Getting a node from the container with node()
The node method returns a single container with the data from a path.
Copying data with copy()
The copy method supports wildcards. The replacement can contain variables like used in expand().
Moving data with move()
The move method supports wildcards. The replacement can contain variables like used in expand().
Creating a decorator
Decorators of a data container can be created using
DataContainerDecoratorTrait
.
Both implementations contain all methods of DataContainerInterface
.
Creating a traversable decorator
A decorator that is also traversable can be created with
DataContainerIteratorAggregateTrait
.
Filtering a container
To filter a container, an implementation of DataContainerFilterInterface
is
required.
A default implementation, used for chaining, is available.