Parser
The Parser
class is a simple service that parses data into a string. The parser leverages the (https://packagist.org/packages/nicmart/string-template) package.
Basic Usage
Include the Anomaly\Streams\Platform\Support\Parser
class in your code to get started.
Parser::parse()
The parse
method recursively parses the value with given data.
Returns: string
Arguments
Key | Required | Type | Default | Description |
---|---|---|---|---|
$target |
true |
mixed |
none |
The string or array of strings. |
$data |
false |
array |
none |
An array of data to parse into the $target. |
Example
$parser->parse('Hello {user.first_name} {user.last_name}!', ['user' => Auth::user()]);