Declaratively specify how to extract elements from a JSON document, in PHP

Overview

jmespath.php

JMESPath (pronounced "jaymz path") allows you to declaratively specify how to extract elements from a JSON document. jmespath.php allows you to use JMESPath in PHP applications with PHP data structures. It requires PHP 5.4 or greater and can be installed through Composer using the mtdowling/jmespath.php package.

require 'vendor/autoload.php';

$expression = 'foo.*.baz';

$data = [
    'foo' => [
        'bar' => ['baz' => 1],
        'bam' => ['baz' => 2],
        'boo' => ['baz' => 3]
    ]
];

JmesPath\search($expression, $data);
// Returns: [1, 2, 3]

PHP Usage

The JmesPath\search function can be used in most cases when using the library. This function utilizes a JMESPath runtime based on your environment. The runtime utilized can be configured using environment variables and may at some point in the future automatically utilize a C extension if available.

$result = JmesPath\search($expression, $data);

// or, if you require PSR-4 compliance.
$result = JmesPath\Env::search($expression, $data);

Runtimes

jmespath.php utilizes runtimes. There are currently two runtimes: AstRuntime and CompilerRuntime.

AstRuntime is utilized by JmesPath\search() and JmesPath\Env::search() by default.

AstRuntime

The AstRuntime will parse an expression, cache the resulting AST in memory, and interpret the AST using an external tree visitor. AstRuntime provides a good general approach for interpreting JMESPath expressions that have a low to moderate level of reuse.

$runtime = new JmesPath\AstRuntime();
$runtime('foo.bar', ['foo' => ['bar' => 'baz']]);
// > 'baz'

CompilerRuntime

JmesPath\CompilerRuntime provides the most performance for applications that have a moderate to high level of reuse of JMESPath expressions. The CompilerRuntime will walk a JMESPath AST and emit PHP source code, resulting in anywhere from 7x to 60x speed improvements.

Compiling JMESPath expressions to source code is a slower process than just walking and interpreting a JMESPath AST (via the AstRuntime). However, running the compiled JMESPath code results in much better performance than walking an AST. This essentially means that there is a warm-up period when using the CompilerRuntime, but after the warm-up period, it will provide much better performance.

Use the CompilerRuntime if you know that you will be executing JMESPath expressions more than once or if you can pre-compile JMESPath expressions before executing them (for example, server-side applications).

// Note: The cache directory argument is optional.
$runtime = new JmesPath\CompilerRuntime('/path/to/compile/folder');
$runtime('foo.bar', ['foo' => ['bar' => 'baz']]);
// > 'baz'
Environment Variables

You can utilize the CompilerRuntime in JmesPath\search() by setting the JP_PHP_COMPILE environment variable to "on" or to a directory on disk used to store cached expressions.

Testing

A comprehensive list of test cases can be found at https://github.com/jmespath/jmespath.php/tree/master/tests/compliance. These compliance tests are utilized by jmespath.php to ensure consistency with other implementations, and can serve as examples of the language.

jmespath.php is tested using PHPUnit. In order to run the tests, you need to first install the dependencies using Composer as described in the Installation section. Next you just need to run the tests via make:

make test

You can run a suite of performance tests as well:

make perf
Comments
  • Allow version 2.x for xdebug-handler dependency

    Allow version 2.x for xdebug-handler dependency

    jmespath.php is not affected by any of the breaking changes in current version 2.0 of xdebug-handler, so it is safe to allow both v1.4 and v2.0 as a dependency.

    More info on the changes in xdebug-handler is listed in its UPGRADE.md.

    opened by mrtnmtth 7
  • Composer error

    Composer error

    Running composer require mtdowling/jmespath.php I get the following error:

    Package operations: 1 install, 0 updates, 0 removals
      - Installing mtdowling/jmespath.php (2.6.0): Extracting archive
        Install of mtdowling/jmespath.php failed
    
    Installation failed, reverting ./composer.json to its original content.
    
      [ErrorException]                                                                                                                  
      file_get_contents(/home/vagrant/code/vendor/mtdowling/jmespath.php/bin/jp.php): Failed to open stream: No such file or directory 
    

    I don't know what I can do. It seems a package issue. Anyone have the same problem?

    • PHP 8.0.1
    opened by ilvalerione 6
  • Support PHP stream wrappers for defining runtime compile folder

    Support PHP stream wrappers for defining runtime compile folder

    It would be interesting to be able to pass in a stream wrapper value like temporary://<randombytes>_jmes_runtime_compile_dir when creating a Jmes Runtime.

    opened by jameswilson 6
  • Expression tokenizes incorrectly on EC2.

    Expression tokenizes incorrectly on EC2.

    This has taken me hours to debug. I've not found the problem due to not being able to xdebug the remote env, but here we go:

    I have an expression which is being tokenized incorrectly on EC2 for reasons which i can't figure out. for what i can see php versions and extensions are mostly identical.

    I've come to this conclusion by switching to the compiler runtime and comparing the generated cache file.

    See the following gist for the two generated files. https://gist.github.com/bendavies/2d3d9e3c7b5d0b925259

    incorrect.php is generated on ec2.

    The line to note is number 23. Notice how the value is incorrect in incorrect.php

    I know this a terrible bug report with no information that lets you reproduce the bug. Please let me know what you need.

    Many thanks in advance.

    P.S Oh, and the jmespath.php testsuite passes just fine on the ec2 server.

    opened by bendavies 6
  • Syntax errors with hypens in object key

    Syntax errors with hypens in object key

    I get the following exception:

    JmesPath\SyntaxErrorException : Syntax error at character 23
    data.relationships.flow-actions.data[].id
                           ^
    Did not reach the end of the token stream
    

    With a JSON document like:

    {
      "data": {
        "type": "flows",
        "id": "e365203f-b386-4ff0-903e-4c5d275a6988",
        "attributes": {
          "name": "Patient Intake",
          "details": "Intake of a new Dialysis patient.",
          "updated_at": "2020-01-07T16:53:25.174226+00:00",
          "created_at": "2020-01-07T16:53:25.169026+00:00"
        },
        "relationships": {
          "flow-actions": {
            "links": {
              "related": "http://localhost:8080/flows/e365203f-b386-4ff0-903e-4c5d275a6988/flow-actions"
            },
            "data": [
              {
                "type": "flow-actions",
                "id": "6a7f3aae-6bb3-4b80-af4c-cdeb209503d0"
              }
            ]
          }
        },
        "links": {
          "self": "http://localhost:8080/flows/e365203f-b386-4ff0-903e-4c5d275a6988"
        }
      }
    }
    

    The same expression works correctly with the http://jmespath.org/ demo on the home page.

    opened by shadowhand 5
  • Support for

    Support for "and expressions" in filters

    I had a few issues with the Ruby jmespath implementation (see https://github.com/jmespath/jmespath.rb/issues/13) so I thought I'd see what the behaviour here was.

    My main problem was that and expressions in filters didn't work and that seems to be the case for the PHP implementation too.

    /*
     Should return null, instead fails with
    Syntax error at character 6
    [?foo && bar]
          ^
    Expected a closing rbracket for the filter
    */
    JMESPath\search('[?foo && bar]', (object) []);
    
    /* On the off chance it's a problem parsing unary filters in combination with and expressions I tried
    this, but same problem
    Syntax error at character 15
    [?foo == `bar` && bar == `blarg`]
                   ^
    Expected a closing rbracket for the filter
    */
    JMESPath\search('[?foo == `bar` && bar == `blarg`]', (object) []);
    

    Unlike the ruby implementation, or expressions do work as expected. There is some weirdness with string matching (variables delimited by single quotes and double quotes parse, but single quotes matches correct and double quotes don't match at all; it appears in the current spec that single quotes are fine but double quotes should probably be a parse error. The current spec also doesn't seem to accept backtick delimited strings, but the PHP lib does while the Ruby one doesn't) but otherwise it just seems that and expressions aren't supported.

    If support for this hasn't been implemented yet (although the spec is from July '14, I can't see when it was accepted, and I notice that the JS version has only recently added support in https://github.com/jmespath/jmespath.js/issues/9) it would be useful to have a section indicating as yet unsupported features like this.

    opened by elyobo 5
  • PHP 7.2 compatibility issues with `make perf`

    PHP 7.2 compatibility issues with `make perf`

    $ php --version
    PHP 7.2.0 (cli) (built: Dec  3 2017 21:46:44) ( NTS )
    Copyright (c) 1997-2017 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
        with Zend OPcache v7.2.0, Copyright (c) 1999-2017, by Zend Technologies
        with Xdebug v2.6.0alpha1, Copyright (c) 2002-2017, by Derick Rethans
    

    On a fresh clone of the repo, I installed the Composer dependencies and ran make perf.

    $ make perf
    php bin/perf.php
    time: 00.0269ms name: single_expression
    time: 00.0510ms name: single_dot_expression
    time: 00.0758ms name: double_dot_expression
    time: 00.0989ms name: dot_no_match
    time: 00.2432ms name: deep_nesting_10
    time: 01.1330ms name: deep_nesting_50
    time: 01.1511ms name: deep_nesting_50_pipe
    time: 01.3411ms name: deep_nesting_50_index
    PHP Fatal error:  Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /Library/WebServer/Documents/jmespath.php/src/Parser.php:105
    Stack trace:
    #0 /Library/WebServer/Documents/jmespath.php/src/Parser.php(97): JmesPath\Parser->nud_identifier()
    #1 /Library/WebServer/Documents/jmespath.php/src/Parser.php(351): JmesPath\Parser->expr(20)
    #2 /Library/WebServer/Documents/jmespath.php/src/Parser.php(336): JmesPath\Parser->parseDot(20)
    #3 /Library/WebServer/Documents/jmespath.php/src/Parser.php(393): JmesPath\Parser->parseProjection(20)
    #4 /Library/WebServer/Documents/jmespath.php/src/Parser.php(213): JmesPath\Parser->parseWildcardArray(Array)
    #5 /Library/WebServer/Documents/jmespath.php/src/Parser.php(99): JmesPath\Parser->led_lbracket(Array)
    #6 /Library/WebServer/Documents/jmespath.php/src/Parser.php(351): JmesPath\Parser->expr(20)
    #7 /Library/WebServer/Documents/jmespath.php/src/Parser.php(336): JmesPath\Parser->parseDot(20)
    #8 /Library/WebServer/Documents/jmespath.php/src/Parser.php(393): JmesPath\Parser-> in /Library/WebServer/Documents/jmespath.php/src/Parser.php on line 105
    
    Fatal error: Uncaught Error: Maximum function nesting level of '256' reached, aborting! in /Library/WebServer/Documents/jmespath.php/src/Parser.php on line 105
    
    Error: Maximum function nesting level of '256' reached, aborting! in /Library/WebServer/Documents/jmespath.php/src/Parser.php on line 105
    
    Call Stack:
        0.0005     411992   1. {main}() /Library/WebServer/Documents/jmespath.php/bin/perf.php:0
        0.5385     972688   2. runSuite() /Library/WebServer/Documents/jmespath.php/bin/perf.php:12
        0.5387     976424   3. runCase() /Library/WebServer/Documents/jmespath.php/bin/perf.php:26
        0.5387     976816   4. JmesPath\AstRuntime->__invoke() /Library/WebServer/Documents/jmespath.php/bin/perf.php:40
        0.5387     976816   5. JmesPath\Parser->parse() /Library/WebServer/Documents/jmespath.php/src/AstRuntime.php:42
        0.5407    1222536   6. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:79
        0.5407    1222912   7. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5408    1222912   8. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5408    1223936   9. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5408    1223936  10. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5408    1223936  11. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5408    1224312  12. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5408    1224312  13. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5408    1225064  14. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5408    1225064  15. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5408    1225064  16. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5408    1225440  17. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5408    1225440  18. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5408    1226192  19. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5408    1226192  20. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5408    1226192  21. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5408    1226568  22. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5408    1226568  23. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5408    1227320  24. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5408    1227320  25. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5408    1227320  26. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5408    1227696  27. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5408    1227696  28. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5408    1228448  29. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5408    1228448  30. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5408    1228448  31. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5409    1228824  32. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5409    1228824  33. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5409    1229576  34. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5409    1229576  35. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5409    1229576  36. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5409    1229952  37. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5409    1229952  38. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5409    1230704  39. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5409    1230704  40. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5409    1230704  41. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5409    1231080  42. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5409    1231080  43. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5409    1231832  44. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5409    1231832  45. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5409    1231832  46. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5409    1232208  47. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5409    1232208  48. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5409    1232960  49. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5409    1232960  50. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5409    1232960  51. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5409    1233336  52. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5409    1233336  53. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5409    1234088  54. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5409    1234088  55. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5409    1234088  56. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5409    1234464  57. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5409    1234464  58. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5410    1235216  59. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5410    1235216  60. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5410    1235216  61. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5410    1235592  62. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5410    1235592  63. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5410    1236344  64. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5410    1236344  65. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5410    1236344  66. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5410    1236720  67. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5410    1236720  68. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5410    1237472  69. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5410    1237472  70. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5410    1237472  71. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5410    1237848  72. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5410    1237848  73. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5410    1238600  74. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5410    1238600  75. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5410    1238600  76. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5410    1238976  77. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5410    1238976  78. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5410    1239728  79. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5410    1239728  80. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5410    1239728  81. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5410    1240104  82. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5411    1240104  83. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5411    1240856  84. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5411    1240856  85. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5411    1240856  86. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5411    1241232  87. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5411    1241232  88. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5411    1241984  89. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5411    1241984  90. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5411    1241984  91. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5411    1242360  92. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5411    1242360  93. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5411    1243112  94. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5411    1243112  95. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5411    1243112  96. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5411    1243488  97. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5411    1243488  98. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5411    1244240  99. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5411    1244240 100. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5411    1244240 101. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5411    1244616 102. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5411    1244616 103. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5411    1245368 104. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5411    1245368 105. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5411    1245368 106. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5412    1245744 107. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5412    1245744 108. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5412    1246496 109. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5412    1246496 110. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5412    1246496 111. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5412    1246872 112. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5412    1246872 113. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5412    1247624 114. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5412    1247624 115. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5412    1247624 116. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5412    1248000 117. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5412    1248000 118. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5412    1248752 119. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5412    1248752 120. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5412    1248752 121. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5412    1249128 122. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5412    1249128 123. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5412    1249880 124. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5412    1249880 125. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5412    1249880 126. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5412    1250256 127. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5412    1250256 128. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5413    1251008 129. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5413    1251008 130. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5413    1251008 131. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5413    1251384 132. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5413    1251384 133. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5413    1252136 134. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5413    1252136 135. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5413    1252136 136. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5413    1252512 137. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5413    1252512 138. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5413    1253264 139. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5413    1253264 140. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5413    1253264 141. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5413    1253640 142. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5413    1253640 143. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5413    1254392 144. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5413    1254392 145. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5413    1254392 146. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5413    1254768 147. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5413    1254768 148. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5413    1255520 149. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5413    1255520 150. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5413    1255520 151. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5413    1255896 152. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5413    1255896 153. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5414    1256648 154. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5414    1256648 155. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5414    1256648 156. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5414    1257024 157. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5414    1257024 158. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5414    1257776 159. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5414    1257776 160. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5414    1257776 161. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5414    1258152 162. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5414    1258152 163. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5414    1258904 164. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5414    1258904 165. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5414    1258904 166. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5414    1259280 167. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5414    1259280 168. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5414    1260032 169. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5414    1260032 170. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5414    1260032 171. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5414    1260408 172. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5414    1260408 173. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5415    1261160 174. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5415    1261160 175. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5415    1261160 176. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5415    1261536 177. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5415    1261536 178. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5415    1262288 179. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5415    1262288 180. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5415    1262288 181. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5415    1262664 182. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5415    1262664 183. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5415    1263416 184. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5415    1263416 185. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5415    1263416 186. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5415    1263792 187. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5415    1263792 188. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5415    1264544 189. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5415    1264544 190. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5415    1264544 191. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5415    1264920 192. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5415    1264920 193. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5415    1265672 194. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5416    1265672 195. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5416    1265672 196. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5416    1266048 197. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5416    1266048 198. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5416    1266800 199. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5416    1266800 200. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5416    1266800 201. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5416    1267176 202. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5416    1267176 203. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5416    1267928 204. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5416    1267928 205. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5416    1267928 206. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5416    1268304 207. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5416    1268304 208. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5416    1269056 209. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5416    1269056 210. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5416    1269056 211. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5416    1269432 212. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5416    1269432 213. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5416    1270184 214. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5416    1270184 215. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5416    1270184 216. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5416    1270560 217. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5417    1270560 218. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5417    1271312 219. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5417    1271312 220. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5417    1271312 221. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5417    1271688 222. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5417    1271688 223. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5417    1272440 224. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5417    1272440 225. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5417    1272440 226. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5417    1272816 227. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5417    1272816 228. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5417    1273568 229. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5417    1273568 230. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5417    1273568 231. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5417    1273944 232. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5417    1273944 233. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5417    1274696 234. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5417    1274696 235. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5417    1274696 236. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5417    1275072 237. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5417    1275072 238. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5417    1275824 239. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5417    1275824 240. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5417    1275824 241. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5418    1276200 242. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5418    1276200 243. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5418    1276952 244. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5418    1276952 245. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5418    1276952 246. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5418    1277328 247. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5418    1277328 248. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5418    1278080 249. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5418    1278080 250. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5418    1278080 251. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
        0.5418    1278456 252. JmesPath\Parser->led_lbracket() /Library/WebServer/Documents/jmespath.php/src/Parser.php:99
        0.5418    1278456 253. JmesPath\Parser->parseWildcardArray() /Library/WebServer/Documents/jmespath.php/src/Parser.php:213
        0.5418    1279208 254. JmesPath\Parser->parseProjection() /Library/WebServer/Documents/jmespath.php/src/Parser.php:393
        0.5418    1279208 255. JmesPath\Parser->parseDot() /Library/WebServer/Documents/jmespath.php/src/Parser.php:336
        0.5418    1279208 256. JmesPath\Parser->expr() /Library/WebServer/Documents/jmespath.php/src/Parser.php:351
    
    make: *** [perf] Error 255
    
    opened by skyzyx 4
  • Allow PHP objects to be supported by JmesPath.

    Allow PHP objects to be supported by JmesPath.

    This adds support for PHP objects that are not \Array or \stdClass.

    Provided your classes implement either JmesPathableObjectInterface or JmesPathableArrayInterface you will be able use JMESPath expressions to extract information from objects derived from them. The small example below hopefully provides an explanation.

    $product1 = new StdClassLike();
    $product1->title = 'Item One';
    $product1->price = 4.99;
    
    $product2 = new StdClassLike();
    $product2->title = 'Item Two';
    $product2->price = 9.99;
    
    $basket = new StdClassLike();
    $basket->items = new ArrayLike([
        $product1,
        $product2
    ]);
    
    $result = JmesPath\Env::search('max_by(items, &price)', $basket);
    var_dump($result);
    
    /*
        object(StdClassLike)#7 (1) {
          ["values":"StdClassLike":private]=>
          array(2) {
            ["title"]=>
            string(8) "Item Two"
            ["price"]=>
            float(9.99)
          }
        }
    */
    

    Two gists show how StdClassLike and ArrayLike are implemented.

    I've updated the compliance test so that another pass is made through the test suites. This extra pass rebuilds the json as PHP objects before running the compliance test. Extra tests have also been added to cover the changes made to the code.

    I perfectly understand if these changes won't be accepted. JMESPath is primarily for extracting information from json. Providing the same functionality for PHP objects may be outside of it's scope and there may not be enough interest from PHP developers to justify maintaining the code.

    opened by davidtsadler 4
  • No such a file on composer install or update

    No such a file on composer install or update

    Whenever I try to install any composer dependency - in this case league/flysystem-aws-s3-v3 - which has a dependency your package I get the following error

    `Warning: Uncaught ErrorException: require(C:\wamp64\www\laravel\vendor\composer/../mtdowling/jmespath.php/src/JmesPath.php): failed to open stream: No such file or directory in C:\wamp64\www\laravel\vendor\composer\autoload_real.php:66 Stack trace: #0 C:\wamp64\www\laravel\vendor\composer\autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(C:\wamp...', 'C:\wamp64\www\m...', 66, Array) #1 C:\wamp64\www\laravel\vendor\composer\autoload_real.php(66): require() #2 C:\wamp64\www\laravel\vendor\composer\autoload_real.php(56): composerRequire77f420fae914154a4be36e9c5d235a14('b067bc7112e384b...', 'C:\wamp64\www\m...') #3 C:\wamp64\www\laravel\vendor\autoload.php(7): ComposerAutoloaderInit77f420fae914154a4be36e9c5d235a14::getLoader() #4 C:\wamp64\www\laravel\vendor\kylekatarnls\update-helper\src\UpdateHelper\UpdateHelper.php(137): include_once('C:\wamp64\www\m...') #5 C:\wamp64\www\laravel\vendor\kylekatarnls\update-helper\src\UpdateHelper\ComposerPlugin.php(35): UpdateHelper\UpdateHelper::check(Object(Composer\Script\Even in C:\wamp64\www\laravel\vendor\composer\autoload_real.php on line 66

    Fatal error: composerRequire77f420fae914154a4be36e9c5d235a14(): Failed opening required 'C:\wamp64\www\laravel\vendor\composer/../mtdowling/jmespath.php/src/JmesPath.php' (include_path='.;C:\php\pear') in C:\wamp64\www\laravel\vendor\composer\autoload_real.php on line 66 `

    opened by moisish 3
  • Zero returning null result

    Zero returning null result

    When a key is zero integer/string the result is null. See examples below.

    \JmesPath\Env::search('data.*.id', [
        'data' => [
            0 => [
                'id' => 7
            ],
        ],
    ]); // null
    
    \JmesPath\Env::search('data.*.id', [
        'data' => [
            '0' => [
                'id' => 7
            ],
        ],
    ]); // null
    
    \JmesPath\Env::search('data.*.id', [
        'data' => [
            1 => [
                'id' => 7
            ],
        ],
    ]); // [7]
    
    \JmesPath\Env::search('data.*.id', [
        'data' => [
            '1' => [
                'id' => 7
            ],
        ],
    ]); // [7]
    
    opened by joshuabaker 3
  • Double quotes around literal values not rejected but do not match.

    Double quotes around literal values not rejected but do not match.

    The literal expressions and raw string literals sections of the specification permit literals to be delimited by backticks or single quotes, but jmespath.php is partially allowing double quotes as well; no parse error is returned, but matching doesn't take place. This behaviour is possibly confusing for users that incorrectly try to use double quotes; a parse error, ideally indicating that they should use single quotes or backticks, would be more informative.

    // Expected: parse error
    // Actual: []
    JMESPath\search('[?foo == "bar"]', [['foo' => 'bar']])
    
    opened by elyobo 3
  • Fix flattening in arrays starting with null

    Fix flattening in arrays starting with null

    Current behaviour of the library when facing this scenario:

    {
        "foo": [
            {"bar": [null, null, 3, 5, 6, null]},
            {"bar": [1, 3, null, 5]}
         ]
    }
    
    foo[*].bar[]
    

    is this:

    Array
    (
        [0] => Array
            (
                [0] => 
                [1] => 
                [2] => 3
                [3] => 5
                [4] => 6
                [5] => 
            )
    
        [1] => 1
        [2] => 3
        [3] => 5
    )
    
    

    but expected behaviour would be this:

    Array
    (
        [0] => 3
        [1] => 5
        [2] => 6
        [3] => 1
        [4] => 3
        [5] => 5
    )
    

    Demo on official Jmespath homepage:

    Screenshot 2022-08-25 at 12 34 01

    Fix

    The bug is caused by a "loose" isset() check, which makes a list array not be treated as a list array when the first position is null (i.e. isset($array[0]) will evaluate to false, but that does not exclusively mean the array does not have a position 0).

    (I noticed there is an existing Utils::isArray() method, so maybe it is better to use that instead of the change I made, but I was not sure that method was 100% intended for what we want to check in this particular case.)

    opened by albertboada 0
  • Unexpected empty array returned on expression rather than NULL

    Unexpected empty array returned on expression rather than NULL

    I just wanted to confirm / point out that I am receiving back a value from the below method that is different from the code comments:

    \JmesPath\Env::search($expression, $data);

    https://github.com/jmespath/jmespath.php/blob/master/src/Env.php#L25

    The document block states that I should @return mixed Returns the matching data or null receive matching data or null but I have found that when I utilise this with object or list projection like:

    included[?type=='paragraph--basic_text'] as long as the included array exists in the JSON, it will return an empty array rather than a NULL value.

    Can I confirm that this is the expected behaviour?

    Checking the tutorial website I get the same result in different versions of jmespath.

    Thank you very much for the package. I am utilising it in integration testing to evaluate json responses which is incredibly useful.

    opened by richardgaunt 0
  • Combined syntax compliance

    Combined syntax compliance

    We currently fail on the following upstream compliance tests:

      {
        "comment": "Combined syntax",
        "given": [],
        "cases": [
            {
              "expression": "*||*|*|*",
              "result": null
            },
            {
              "expression": "*[]||[*]",
              "result": []
            },
            {
              "expression": "[*.*]",
              "result": [null]
            }
        ]
      }
    

    The first and last case are incorrect, but we handle the middle case correctly at the moment.

    opened by GrahamCampbell 0
  • add custom functions feature

    add custom functions feature

    Hello ;-)

    With envy I have seen that jmespath.py added a custom function feature in jmespath/jmespath.py#102 - and that is something I need for the PHP implementation too ;-) so I created this PR that should add this feature - I also added tests and documentation.

    let me know if anything is missing.

    PS: I also changed the singleton handling a bit in FnDispatcher as IMHO the instance should be a defined static class property, not implicitly created in the getInstance() method.

    opened by narcoticfresh 4
Releases(2.6.1)
  • 2.6.1(Jun 14, 2021)

  • 2.6.0(Jul 31, 2020)

  • 2.5.0(Dec 30, 2019)

  • 2.4.0(Dec 3, 2016)

  • 2.3.0(Jan 5, 2016)

    • Added support for JEP-9, including unary filter expressions, and && filter expressions.
    • Fixed various parsing issues, including not removing escaped single quotes from raw string literals.
    • Added support for the map function.
    • Fixed several issues with code generation.
    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(May 27, 2015)

  • 2.1.0(Jan 13, 2015)

  • 2.0.0(Jan 12, 2015)

    • Moving to a flattened namespace structure.
    • Runtimes are now only PHP callables.
    • Fixed an error in the way empty JSON literals are parsed so that they now return an empty string to match the Python and JavaScript implementations.
    • Removed functions from runtimes. Instead there is now a function dispatcher class, FnDispatcher, that provides function implementations behind a single dispatch function.
    • Removed ExprNode in lieu of just using a PHP callable with bound variables.
    • Removed debug methods from runtimes and instead into a new Debugger class.
    • Heavily cleaned up function argument validation.
    • Slice syntax is now properly validated (i.e., colons are followed by the appropriate value).
    • Lots of code cleanup and performance improvements.
    • Added a convenient JmesPath\search() function.
    • IMPORTANT: Relocating the project to https://github.com/jmespath/jmespath.php
    Source code(tar.gz)
    Source code(zip)
Owner
null
JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

JSONFinder - a library that can find json values in a mixed text or html documents, can filter and search the json tree, and converts php objects to json without 'ext-json' extension.

Eboubaker Eboubaker 2 Jul 31, 2022
Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files

Quality Hook Installer Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files Install

Kay W. 2 Dec 15, 2022
Extract and evolution of the magento2-currency-precision module from the magento2-jp project from @Magento

Currency Precision Module for Magento 2 This module aims to help merchants to manage easily their currency precision in Magento 2. DISCLAIMER Initiall

OpenGento 3 Dec 17, 2021
Small class to extract + compress .zip, .gz, .rar archives via browser.

The Unzipper The Unzipper extracts .zip and .rar archives or .gz/tar.gz files on webservers. It detects .zip/.rar/.tar.gz/.gz archives and let you cho

Lục Thiên Phong 10 Dec 24, 2022
Silverstripe-tinytidy - Control which styles are available in TinyMCE's style dropdown menu and what elements they can be applied to

TinyTidy for SilverStripe This module mainly serves as an example of how to customise the 'styles' dropdown menu in the TinyMCE editor to control whic

Jono Menz 30 Jul 30, 2020
This extensions makes it possible to modify the TCA of container children elements

This extensions makes it possible to modify the TCA of container children elements

Georg Ringer 6 Oct 24, 2022
GDPR compliant TYPO3 content elements which work great with PIWIK Consent Manager.

PIWIK Consent Manager TYPO3 extension PIWIK Consent Manager integration in order to make TYPO3 content elements GDPR compliant. You can click on the i

null 6 Aug 8, 2022
🎨 Free custom elements for the WordPress Theme Bricks Builder.

?? Custom Elements for Bricks Builder Free custom elements for Bricks, the visual site builder for WordPress. If you find the elements useful, click o

Simon Vidman 33 Dec 13, 2022
A PHP package for MRZ (Machine Readable Zones) code parser for Passport, Visa & Travel Document (TD1 & TD2).

MRZ (Machine Readable Zones) Parser for PHP A PHP package for MRZ (Machine Readable Zones) code parser for Passport, Visa & Travel Document (TD1 & TD2

Md. Rakibul Islam 25 Aug 24, 2022
Okex API Like the official document interface, Support for arbitrary extension.

It is recommended that you read the official document first Okex docs https://www.okex.com/docs/en Okex Simulation Test API https://www.okex.com/docs/

lin 34 Jan 1, 2023
A simple library for management the DOM (XML, HTML) document.

A simple library for management the DOM (XML, HTML) document.

Alexey 3 Oct 1, 2022
This document provides the details related to Remittance API. This APIs is used to initiate payment request from Mobile client/others exchange house.

City Bank Remittance API This is where your description should go. Limit it to a paragraph or two. Consider adding a small example. Installation You c

MD ARIFUL HAQUE 2 Oct 2, 2022
Allows generate class files parse from json and map json to php object, including multi-level and complex objects;

nixihz/php-object Allows generate class files parse from json and map json to php object, including multi-level and complex objects; Installation You

zhixin 2 Sep 9, 2022
Json-normalizer: Provides generic and vendor-specific normalizers for normalizing JSON documents

json-normalizer Provides generic and vendor-specific normalizers for normalizing JSON documents. Installation Run $ composer require ergebnis/json-nor

null 64 Dec 31, 2022
PDF API. JSON to PDF. PDF Template Management, Visual HTML Template Editor and API to render PDFS by json data

PDF Template Management, Visual HTML Template Editor and API to render PDFS by json data PDF ENGINE VERSION: development: This is a prerelease version

Ajous Solutions 2 Dec 30, 2022
Zilliqa PHP is a typed PHP-7.1+ interface to Zilliqa JSON-RPC API.

Zilliqa PHP is a typed PHP-7.1+ interface to Zilliqa JSON-RPC API. Check out the latest API documentation. Add library in a composer.json file.

Patrick Falize 6 Oct 7, 2021
Php-rpc-server - JSON RPC server implementation for PHP.

JSON RPC Server implementation for PHP. The json-rpc is a very simple protocol. You can see this by reading the protocol specification. This library i

null 4 Sep 28, 2022
JSON Lint for PHP

JSON Lint Usage use Seld\JsonLint\JsonParser; $parser = new JsonParser(); // returns null if it's valid json, or a ParsingException object. $parser-

Jordi Boggiano 1.3k Dec 26, 2022
Simple game server with php without socket programming. Uses the Api request post(json).

QMA server Simple game server with php without socket programming. Uses the Api request post(json). What does this code do? Register the user as a gue

reza malekpour 3 Sep 4, 2021