\JmesPathEnv

Provides a simple environment based search.

The runtime utilized by the Env class can be customized via environment variables. If the JP_PHP_COMPILE environment variable is specified, then the CompilerRuntime will be utilized. If set to "on", JMESPath expressions will be cached to the system's temp directory. Set the environment variable to a string to cache expressions to a specific directory.

Summary

Methods
Properties
Constants
search()
createRuntime()
cleanCompileDir()
No public properties found
COMPILE_DIR
No protected methods found
No protected properties found
N/A
getEnvVariable()
No private properties found
N/A

Constants

COMPILE_DIR

COMPILE_DIR = 'JP_PHP_COMPILE'

Methods

search()

search(string  $expression, mixed  $data) : mixed

Returns data from the input array that matches a JMESPath expression.

Parameters

string $expression

JMESPath expression to evaluate

mixed $data

JSON-like data to search

Returns

mixed —

Returns the matching data or null

createRuntime()

createRuntime() : callable

Creates a JMESPath runtime based on environment variables and extensions available on a system.

Returns

callable —

cleanCompileDir()

cleanCompileDir() : int

Delete all previously compiled JMESPath files from the JP_COMPILE_DIR directory or sys_get_temp_dir().

Returns

int —

Returns the number of deleted files.

getEnvVariable()

getEnvVariable(string  $name) : string|null

Reads an environment variable from $_SERVER, $_ENV or via getenv().

Parameters

string $name

Returns

string|null —