├── .gitignore ├── .scrutinizer.yml ├── .travis.yml ├── LICENSE ├── README.md ├── composer.json ├── composer.lock ├── phpunit.xml.dist ├── sample.php ├── src ├── GeoDistance.php ├── NumericRange.php ├── Query.php └── Term.php └── tests ├── QueryTest.php └── TermTest.php /.gitignore: -------------------------------------------------------------------------------- 1 | phpunit.xml 2 | vendor/ 3 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | build: 2 | environment: 3 | mysql: false 4 | redis: false 5 | 6 | tools: 7 | external_code_coverage: true 8 | php_analyzer: true 9 | php_changetracking: true 10 | php_code_sniffer: 11 | config: 12 | standard: "PSR2" 13 | php_mess_detector: true 14 | php_pdepend: true 15 | php_sim: true 16 | 17 | filter: 18 | excluded_paths: 19 | - tests/* 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: 2 | false 3 | 4 | language: 5 | php 6 | 7 | php: 8 | - 5.5 9 | - 5.6 10 | - 7 11 | - hhvm 12 | 13 | cache: 14 | directories: 15 | - vendor 16 | 17 | before_script: 18 | - composer install --dev --no-interaction --prefer-source 19 | 20 | script: 21 | - vendor/bin/phpunit --coverage-clover=coverage.clover --colors 22 | 23 | after_script: 24 | - wget https://scrutinizer-ci.com/ocular.phar 25 | - php ocular.phar code-coverage:upload --format=php-clover coverage.clover 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2015, PHPFluent. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of Alexandre Gomes Gaigalas nor the names of its 15 | contributors may be used to endorse or promote products derived from this 16 | software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ElasticQueryBuilder 2 | 3 | [![Build Status](https://img.shields.io/travis/PHPFluent/ElasticQueryBuilder/master.svg?style=flat-square)](http://travis-ci.org/PHPFluent/ElasticQueryBuilder) 4 | [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/PHPFluent/ElasticQueryBuilder/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/PHPFluent/ElasticQueryBuilder/?branch=master) 5 | [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/PHPFluent/ElasticQueryBuilder/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/PHPFluent/ElasticQueryBuilder/?branch=master) 6 | [![Latest Stable Version](https://img.shields.io/packagist/v/phpfluent/elastic-query-builder.svg?style=flat-square)](https://packagist.org/packages/phpfluent/elastic-query-builder) 7 | [![Total Downloads](https://img.shields.io/packagist/dt/phpfluent/elastic-query-builder.svg?style=flat-square)](https://packagist.org/packages/phpfluent/elastic-query-builder) 8 | [![License](https://img.shields.io/packagist/l/phpfluent/elastic-query-builder.svg?style=flat-square)](https://packagist.org/packages/phpfluent/elastic-query-builder) 9 | 10 | A fluent query builder for Elastic Search. 11 | 12 | ## Installation 13 | 14 | Package is available on [Packagist](http://packagist.org/packages/phpfluent/elastic-query-builder), 15 | you can install it using [Composer](http://getcomposer.org). 16 | 17 | ```shell 18 | composer require phpfluent/elastic-query-builder 19 | ``` 20 | 21 | [PHP](https://php.net) 5.5+ or [HHVM](http://hhvm.com) 3.5+ are required. 22 | 23 | ## Usage 24 | 25 | ```php 26 | $builder = new Query(); 27 | $builder->query()->filtered()->query()->matchAll(new stdClass()); 28 | $builder->query()->filtered()->filter()->and( 29 | [ 30 | new Term('my.nested.label', 'my_value'), 31 | new Term('my_label', 'other_value'), 32 | ] 33 | ); 34 | 35 | echo $builder.PHP_EOL; 36 | ``` 37 | 38 | 39 | The result of the code above is: 40 | ```json 41 | {"query":{"filtered":{"query":{"match_all":{}},"filter":{"and":[{"term":{"my.nested.label":"my_value"}},{"term":{"my_label":"other_value"}}]}}}} 42 | ``` 43 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "phpfluent/elastic-query-builder", 3 | "description": "A fluent query builder for Elastic Search.", 4 | "type": "library", 5 | "homepage": "http://github.com/PHPFluent/ElasticQueryBuilder", 6 | "license": "New BSD", 7 | "authors": [ 8 | { 9 | "name": "Kinn Coelho Julião", 10 | "email": "kinncj@gmail.com" 11 | }, 12 | { 13 | "name": "Henrique Moody", 14 | "email": "henriquemoody@gmail.com" 15 | } 16 | ], 17 | "autoload": { 18 | "psr-4": { 19 | "PHPFluent\\ElasticQueryBuilder\\": "src/" 20 | } 21 | }, 22 | "require": { 23 | "php": ">=5.5" 24 | }, 25 | "require-dev": { 26 | "phpunit/phpunit": "~4.4" 27 | }, 28 | "extra": { 29 | "branch-alias": { 30 | "dev-master": "1.1.x-dev" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "7c7aa542586edc484afd08e7b765c5c1", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "doctrine/instantiator", 12 | "version": "1.0.5", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/doctrine/instantiator.git", 16 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", 21 | "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "php": ">=5.3,<8.0-DEV" 26 | }, 27 | "require-dev": { 28 | "athletic/athletic": "~0.1.8", 29 | "ext-pdo": "*", 30 | "ext-phar": "*", 31 | "phpunit/phpunit": "~4.0", 32 | "squizlabs/php_codesniffer": "~2.0" 33 | }, 34 | "type": "library", 35 | "extra": { 36 | "branch-alias": { 37 | "dev-master": "1.0.x-dev" 38 | } 39 | }, 40 | "autoload": { 41 | "psr-4": { 42 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 43 | } 44 | }, 45 | "notification-url": "https://packagist.org/downloads/", 46 | "license": [ 47 | "MIT" 48 | ], 49 | "authors": [ 50 | { 51 | "name": "Marco Pivetta", 52 | "email": "ocramius@gmail.com", 53 | "homepage": "http://ocramius.github.com/" 54 | } 55 | ], 56 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 57 | "homepage": "https://github.com/doctrine/instantiator", 58 | "keywords": [ 59 | "constructor", 60 | "instantiate" 61 | ], 62 | "support": { 63 | "issues": "https://github.com/doctrine/instantiator/issues", 64 | "source": "https://github.com/doctrine/instantiator/tree/master" 65 | }, 66 | "time": "2015-06-14T21:17:01+00:00" 67 | }, 68 | { 69 | "name": "phpdocumentor/reflection-common", 70 | "version": "1.0.1", 71 | "source": { 72 | "type": "git", 73 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 74 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" 75 | }, 76 | "dist": { 77 | "type": "zip", 78 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 79 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 80 | "shasum": "" 81 | }, 82 | "require": { 83 | "php": ">=5.5" 84 | }, 85 | "require-dev": { 86 | "phpunit/phpunit": "^4.6" 87 | }, 88 | "type": "library", 89 | "extra": { 90 | "branch-alias": { 91 | "dev-master": "1.0.x-dev" 92 | } 93 | }, 94 | "autoload": { 95 | "psr-4": { 96 | "phpDocumentor\\Reflection\\": [ 97 | "src" 98 | ] 99 | } 100 | }, 101 | "notification-url": "https://packagist.org/downloads/", 102 | "license": [ 103 | "MIT" 104 | ], 105 | "authors": [ 106 | { 107 | "name": "Jaap van Otterdijk", 108 | "email": "opensource@ijaap.nl" 109 | } 110 | ], 111 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 112 | "homepage": "http://www.phpdoc.org", 113 | "keywords": [ 114 | "FQSEN", 115 | "phpDocumentor", 116 | "phpdoc", 117 | "reflection", 118 | "static analysis" 119 | ], 120 | "support": { 121 | "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", 122 | "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master" 123 | }, 124 | "time": "2017-09-11T18:02:19+00:00" 125 | }, 126 | { 127 | "name": "phpdocumentor/reflection-docblock", 128 | "version": "3.2.2", 129 | "source": { 130 | "type": "git", 131 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 132 | "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157" 133 | }, 134 | "dist": { 135 | "type": "zip", 136 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157", 137 | "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157", 138 | "shasum": "" 139 | }, 140 | "require": { 141 | "php": ">=5.5", 142 | "phpdocumentor/reflection-common": "^1.0@dev", 143 | "phpdocumentor/type-resolver": "^0.3.0", 144 | "webmozart/assert": "^1.0" 145 | }, 146 | "require-dev": { 147 | "mockery/mockery": "^0.9.4", 148 | "phpunit/phpunit": "^4.4" 149 | }, 150 | "type": "library", 151 | "autoload": { 152 | "psr-4": { 153 | "phpDocumentor\\Reflection\\": [ 154 | "src/" 155 | ] 156 | } 157 | }, 158 | "notification-url": "https://packagist.org/downloads/", 159 | "license": [ 160 | "MIT" 161 | ], 162 | "authors": [ 163 | { 164 | "name": "Mike van Riel", 165 | "email": "me@mikevanriel.com" 166 | } 167 | ], 168 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 169 | "support": { 170 | "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", 171 | "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/3.x" 172 | }, 173 | "time": "2017-08-08T06:39:58+00:00" 174 | }, 175 | { 176 | "name": "phpdocumentor/type-resolver", 177 | "version": "0.3.0", 178 | "source": { 179 | "type": "git", 180 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 181 | "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773" 182 | }, 183 | "dist": { 184 | "type": "zip", 185 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773", 186 | "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773", 187 | "shasum": "" 188 | }, 189 | "require": { 190 | "php": "^5.5 || ^7.0", 191 | "phpdocumentor/reflection-common": "^1.0" 192 | }, 193 | "require-dev": { 194 | "mockery/mockery": "^0.9.4", 195 | "phpunit/phpunit": "^5.2||^4.8.24" 196 | }, 197 | "type": "library", 198 | "extra": { 199 | "branch-alias": { 200 | "dev-master": "1.0.x-dev" 201 | } 202 | }, 203 | "autoload": { 204 | "psr-4": { 205 | "phpDocumentor\\Reflection\\": [ 206 | "src/" 207 | ] 208 | } 209 | }, 210 | "notification-url": "https://packagist.org/downloads/", 211 | "license": [ 212 | "MIT" 213 | ], 214 | "authors": [ 215 | { 216 | "name": "Mike van Riel", 217 | "email": "me@mikevanriel.com" 218 | } 219 | ], 220 | "support": { 221 | "issues": "https://github.com/phpDocumentor/TypeResolver/issues", 222 | "source": "https://github.com/phpDocumentor/TypeResolver/tree/master" 223 | }, 224 | "time": "2017-06-03T08:32:36+00:00" 225 | }, 226 | { 227 | "name": "phpspec/prophecy", 228 | "version": "v1.10.3", 229 | "source": { 230 | "type": "git", 231 | "url": "https://github.com/phpspec/prophecy.git", 232 | "reference": "451c3cd1418cf640de218914901e51b064abb093" 233 | }, 234 | "dist": { 235 | "type": "zip", 236 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", 237 | "reference": "451c3cd1418cf640de218914901e51b064abb093", 238 | "shasum": "" 239 | }, 240 | "require": { 241 | "doctrine/instantiator": "^1.0.2", 242 | "php": "^5.3|^7.0", 243 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", 244 | "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", 245 | "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" 246 | }, 247 | "require-dev": { 248 | "phpspec/phpspec": "^2.5 || ^3.2", 249 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" 250 | }, 251 | "type": "library", 252 | "extra": { 253 | "branch-alias": { 254 | "dev-master": "1.10.x-dev" 255 | } 256 | }, 257 | "autoload": { 258 | "psr-4": { 259 | "Prophecy\\": "src/Prophecy" 260 | } 261 | }, 262 | "notification-url": "https://packagist.org/downloads/", 263 | "license": [ 264 | "MIT" 265 | ], 266 | "authors": [ 267 | { 268 | "name": "Konstantin Kudryashov", 269 | "email": "ever.zet@gmail.com", 270 | "homepage": "http://everzet.com" 271 | }, 272 | { 273 | "name": "Marcello Duarte", 274 | "email": "marcello.duarte@gmail.com" 275 | } 276 | ], 277 | "description": "Highly opinionated mocking framework for PHP 5.3+", 278 | "homepage": "https://github.com/phpspec/prophecy", 279 | "keywords": [ 280 | "Double", 281 | "Dummy", 282 | "fake", 283 | "mock", 284 | "spy", 285 | "stub" 286 | ], 287 | "support": { 288 | "issues": "https://github.com/phpspec/prophecy/issues", 289 | "source": "https://github.com/phpspec/prophecy/tree/v1.10.3" 290 | }, 291 | "time": "2020-03-05T15:02:03+00:00" 292 | }, 293 | { 294 | "name": "phpunit/php-code-coverage", 295 | "version": "2.2.4", 296 | "source": { 297 | "type": "git", 298 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 299 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" 300 | }, 301 | "dist": { 302 | "type": "zip", 303 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", 304 | "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", 305 | "shasum": "" 306 | }, 307 | "require": { 308 | "php": ">=5.3.3", 309 | "phpunit/php-file-iterator": "~1.3", 310 | "phpunit/php-text-template": "~1.2", 311 | "phpunit/php-token-stream": "~1.3", 312 | "sebastian/environment": "^1.3.2", 313 | "sebastian/version": "~1.0" 314 | }, 315 | "require-dev": { 316 | "ext-xdebug": ">=2.1.4", 317 | "phpunit/phpunit": "~4" 318 | }, 319 | "suggest": { 320 | "ext-dom": "*", 321 | "ext-xdebug": ">=2.2.1", 322 | "ext-xmlwriter": "*" 323 | }, 324 | "type": "library", 325 | "extra": { 326 | "branch-alias": { 327 | "dev-master": "2.2.x-dev" 328 | } 329 | }, 330 | "autoload": { 331 | "classmap": [ 332 | "src/" 333 | ] 334 | }, 335 | "notification-url": "https://packagist.org/downloads/", 336 | "license": [ 337 | "BSD-3-Clause" 338 | ], 339 | "authors": [ 340 | { 341 | "name": "Sebastian Bergmann", 342 | "email": "sb@sebastian-bergmann.de", 343 | "role": "lead" 344 | } 345 | ], 346 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 347 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 348 | "keywords": [ 349 | "coverage", 350 | "testing", 351 | "xunit" 352 | ], 353 | "support": { 354 | "irc": "irc://irc.freenode.net/phpunit", 355 | "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", 356 | "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/2.2" 357 | }, 358 | "time": "2015-10-06T15:47:00+00:00" 359 | }, 360 | { 361 | "name": "phpunit/php-file-iterator", 362 | "version": "1.4.5", 363 | "source": { 364 | "type": "git", 365 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 366 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" 367 | }, 368 | "dist": { 369 | "type": "zip", 370 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", 371 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", 372 | "shasum": "" 373 | }, 374 | "require": { 375 | "php": ">=5.3.3" 376 | }, 377 | "type": "library", 378 | "extra": { 379 | "branch-alias": { 380 | "dev-master": "1.4.x-dev" 381 | } 382 | }, 383 | "autoload": { 384 | "classmap": [ 385 | "src/" 386 | ] 387 | }, 388 | "notification-url": "https://packagist.org/downloads/", 389 | "license": [ 390 | "BSD-3-Clause" 391 | ], 392 | "authors": [ 393 | { 394 | "name": "Sebastian Bergmann", 395 | "email": "sb@sebastian-bergmann.de", 396 | "role": "lead" 397 | } 398 | ], 399 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 400 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 401 | "keywords": [ 402 | "filesystem", 403 | "iterator" 404 | ], 405 | "support": { 406 | "irc": "irc://irc.freenode.net/phpunit", 407 | "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", 408 | "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5" 409 | }, 410 | "time": "2017-11-27T13:52:08+00:00" 411 | }, 412 | { 413 | "name": "phpunit/php-text-template", 414 | "version": "1.2.1", 415 | "source": { 416 | "type": "git", 417 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 418 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 419 | }, 420 | "dist": { 421 | "type": "zip", 422 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 423 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 424 | "shasum": "" 425 | }, 426 | "require": { 427 | "php": ">=5.3.3" 428 | }, 429 | "type": "library", 430 | "autoload": { 431 | "classmap": [ 432 | "src/" 433 | ] 434 | }, 435 | "notification-url": "https://packagist.org/downloads/", 436 | "license": [ 437 | "BSD-3-Clause" 438 | ], 439 | "authors": [ 440 | { 441 | "name": "Sebastian Bergmann", 442 | "email": "sebastian@phpunit.de", 443 | "role": "lead" 444 | } 445 | ], 446 | "description": "Simple template engine.", 447 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 448 | "keywords": [ 449 | "template" 450 | ], 451 | "support": { 452 | "issues": "https://github.com/sebastianbergmann/php-text-template/issues", 453 | "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" 454 | }, 455 | "time": "2015-06-21T13:50:34+00:00" 456 | }, 457 | { 458 | "name": "phpunit/php-timer", 459 | "version": "1.0.9", 460 | "source": { 461 | "type": "git", 462 | "url": "https://github.com/sebastianbergmann/php-timer.git", 463 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" 464 | }, 465 | "dist": { 466 | "type": "zip", 467 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 468 | "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", 469 | "shasum": "" 470 | }, 471 | "require": { 472 | "php": "^5.3.3 || ^7.0" 473 | }, 474 | "require-dev": { 475 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 476 | }, 477 | "type": "library", 478 | "extra": { 479 | "branch-alias": { 480 | "dev-master": "1.0-dev" 481 | } 482 | }, 483 | "autoload": { 484 | "classmap": [ 485 | "src/" 486 | ] 487 | }, 488 | "notification-url": "https://packagist.org/downloads/", 489 | "license": [ 490 | "BSD-3-Clause" 491 | ], 492 | "authors": [ 493 | { 494 | "name": "Sebastian Bergmann", 495 | "email": "sb@sebastian-bergmann.de", 496 | "role": "lead" 497 | } 498 | ], 499 | "description": "Utility class for timing", 500 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 501 | "keywords": [ 502 | "timer" 503 | ], 504 | "support": { 505 | "issues": "https://github.com/sebastianbergmann/php-timer/issues", 506 | "source": "https://github.com/sebastianbergmann/php-timer/tree/master" 507 | }, 508 | "time": "2017-02-26T11:10:40+00:00" 509 | }, 510 | { 511 | "name": "phpunit/php-token-stream", 512 | "version": "1.4.12", 513 | "source": { 514 | "type": "git", 515 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 516 | "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" 517 | }, 518 | "dist": { 519 | "type": "zip", 520 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", 521 | "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", 522 | "shasum": "" 523 | }, 524 | "require": { 525 | "ext-tokenizer": "*", 526 | "php": ">=5.3.3" 527 | }, 528 | "require-dev": { 529 | "phpunit/phpunit": "~4.2" 530 | }, 531 | "type": "library", 532 | "extra": { 533 | "branch-alias": { 534 | "dev-master": "1.4-dev" 535 | } 536 | }, 537 | "autoload": { 538 | "classmap": [ 539 | "src/" 540 | ] 541 | }, 542 | "notification-url": "https://packagist.org/downloads/", 543 | "license": [ 544 | "BSD-3-Clause" 545 | ], 546 | "authors": [ 547 | { 548 | "name": "Sebastian Bergmann", 549 | "email": "sebastian@phpunit.de" 550 | } 551 | ], 552 | "description": "Wrapper around PHP's tokenizer extension.", 553 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 554 | "keywords": [ 555 | "tokenizer" 556 | ], 557 | "support": { 558 | "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", 559 | "source": "https://github.com/sebastianbergmann/php-token-stream/tree/1.4" 560 | }, 561 | "abandoned": true, 562 | "time": "2017-12-04T08:55:13+00:00" 563 | }, 564 | { 565 | "name": "phpunit/phpunit", 566 | "version": "4.8.28", 567 | "source": { 568 | "type": "git", 569 | "url": "https://github.com/sebastianbergmann/phpunit.git", 570 | "reference": "558a3a0d28b4cb7e4a593a4fbd2220e787076225" 571 | }, 572 | "dist": { 573 | "type": "zip", 574 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/558a3a0d28b4cb7e4a593a4fbd2220e787076225", 575 | "reference": "558a3a0d28b4cb7e4a593a4fbd2220e787076225", 576 | "shasum": "" 577 | }, 578 | "require": { 579 | "ext-dom": "*", 580 | "ext-json": "*", 581 | "ext-pcre": "*", 582 | "ext-reflection": "*", 583 | "ext-spl": "*", 584 | "php": ">=5.3.3", 585 | "phpspec/prophecy": "^1.3.1", 586 | "phpunit/php-code-coverage": "~2.1", 587 | "phpunit/php-file-iterator": "~1.4", 588 | "phpunit/php-text-template": "~1.2", 589 | "phpunit/php-timer": "^1.0.6", 590 | "phpunit/phpunit-mock-objects": "~2.3", 591 | "sebastian/comparator": "~1.1", 592 | "sebastian/diff": "~1.2", 593 | "sebastian/environment": "~1.3", 594 | "sebastian/exporter": "~1.2", 595 | "sebastian/global-state": "~1.0", 596 | "sebastian/version": "~1.0", 597 | "symfony/yaml": "~2.1|~3.0" 598 | }, 599 | "suggest": { 600 | "phpunit/php-invoker": "~1.1" 601 | }, 602 | "bin": [ 603 | "phpunit" 604 | ], 605 | "type": "library", 606 | "extra": { 607 | "branch-alias": { 608 | "dev-master": "4.8.x-dev" 609 | } 610 | }, 611 | "autoload": { 612 | "classmap": [ 613 | "src/" 614 | ] 615 | }, 616 | "notification-url": "https://packagist.org/downloads/", 617 | "license": [ 618 | "BSD-3-Clause" 619 | ], 620 | "authors": [ 621 | { 622 | "name": "Sebastian Bergmann", 623 | "email": "sebastian@phpunit.de", 624 | "role": "lead" 625 | } 626 | ], 627 | "description": "The PHP Unit Testing framework.", 628 | "homepage": "https://phpunit.de/", 629 | "keywords": [ 630 | "phpunit", 631 | "testing", 632 | "xunit" 633 | ], 634 | "support": { 635 | "issues": "https://github.com/sebastianbergmann/phpunit/issues", 636 | "source": "https://github.com/sebastianbergmann/phpunit/tree/4.8" 637 | }, 638 | "time": "2016-11-14T06:25:28+00:00" 639 | }, 640 | { 641 | "name": "phpunit/phpunit-mock-objects", 642 | "version": "2.3.8", 643 | "source": { 644 | "type": "git", 645 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 646 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" 647 | }, 648 | "dist": { 649 | "type": "zip", 650 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", 651 | "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", 652 | "shasum": "" 653 | }, 654 | "require": { 655 | "doctrine/instantiator": "^1.0.2", 656 | "php": ">=5.3.3", 657 | "phpunit/php-text-template": "~1.2", 658 | "sebastian/exporter": "~1.2" 659 | }, 660 | "require-dev": { 661 | "phpunit/phpunit": "~4.4" 662 | }, 663 | "suggest": { 664 | "ext-soap": "*" 665 | }, 666 | "type": "library", 667 | "extra": { 668 | "branch-alias": { 669 | "dev-master": "2.3.x-dev" 670 | } 671 | }, 672 | "autoload": { 673 | "classmap": [ 674 | "src/" 675 | ] 676 | }, 677 | "notification-url": "https://packagist.org/downloads/", 678 | "license": [ 679 | "BSD-3-Clause" 680 | ], 681 | "authors": [ 682 | { 683 | "name": "Sebastian Bergmann", 684 | "email": "sb@sebastian-bergmann.de", 685 | "role": "lead" 686 | } 687 | ], 688 | "description": "Mock Object library for PHPUnit", 689 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 690 | "keywords": [ 691 | "mock", 692 | "xunit" 693 | ], 694 | "support": { 695 | "irc": "irc://irc.freenode.net/phpunit", 696 | "issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues", 697 | "source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/2.3" 698 | }, 699 | "abandoned": true, 700 | "time": "2015-10-02T06:51:40+00:00" 701 | }, 702 | { 703 | "name": "sebastian/comparator", 704 | "version": "1.2.4", 705 | "source": { 706 | "type": "git", 707 | "url": "https://github.com/sebastianbergmann/comparator.git", 708 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" 709 | }, 710 | "dist": { 711 | "type": "zip", 712 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 713 | "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", 714 | "shasum": "" 715 | }, 716 | "require": { 717 | "php": ">=5.3.3", 718 | "sebastian/diff": "~1.2", 719 | "sebastian/exporter": "~1.2 || ~2.0" 720 | }, 721 | "require-dev": { 722 | "phpunit/phpunit": "~4.4" 723 | }, 724 | "type": "library", 725 | "extra": { 726 | "branch-alias": { 727 | "dev-master": "1.2.x-dev" 728 | } 729 | }, 730 | "autoload": { 731 | "classmap": [ 732 | "src/" 733 | ] 734 | }, 735 | "notification-url": "https://packagist.org/downloads/", 736 | "license": [ 737 | "BSD-3-Clause" 738 | ], 739 | "authors": [ 740 | { 741 | "name": "Jeff Welch", 742 | "email": "whatthejeff@gmail.com" 743 | }, 744 | { 745 | "name": "Volker Dusch", 746 | "email": "github@wallbash.com" 747 | }, 748 | { 749 | "name": "Bernhard Schussek", 750 | "email": "bschussek@2bepublished.at" 751 | }, 752 | { 753 | "name": "Sebastian Bergmann", 754 | "email": "sebastian@phpunit.de" 755 | } 756 | ], 757 | "description": "Provides the functionality to compare PHP values for equality", 758 | "homepage": "http://www.github.com/sebastianbergmann/comparator", 759 | "keywords": [ 760 | "comparator", 761 | "compare", 762 | "equality" 763 | ], 764 | "support": { 765 | "issues": "https://github.com/sebastianbergmann/comparator/issues", 766 | "source": "https://github.com/sebastianbergmann/comparator/tree/1.2" 767 | }, 768 | "time": "2017-01-29T09:50:25+00:00" 769 | }, 770 | { 771 | "name": "sebastian/diff", 772 | "version": "1.4.3", 773 | "source": { 774 | "type": "git", 775 | "url": "https://github.com/sebastianbergmann/diff.git", 776 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" 777 | }, 778 | "dist": { 779 | "type": "zip", 780 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", 781 | "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", 782 | "shasum": "" 783 | }, 784 | "require": { 785 | "php": "^5.3.3 || ^7.0" 786 | }, 787 | "require-dev": { 788 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" 789 | }, 790 | "type": "library", 791 | "extra": { 792 | "branch-alias": { 793 | "dev-master": "1.4-dev" 794 | } 795 | }, 796 | "autoload": { 797 | "classmap": [ 798 | "src/" 799 | ] 800 | }, 801 | "notification-url": "https://packagist.org/downloads/", 802 | "license": [ 803 | "BSD-3-Clause" 804 | ], 805 | "authors": [ 806 | { 807 | "name": "Kore Nordmann", 808 | "email": "mail@kore-nordmann.de" 809 | }, 810 | { 811 | "name": "Sebastian Bergmann", 812 | "email": "sebastian@phpunit.de" 813 | } 814 | ], 815 | "description": "Diff implementation", 816 | "homepage": "https://github.com/sebastianbergmann/diff", 817 | "keywords": [ 818 | "diff" 819 | ], 820 | "support": { 821 | "issues": "https://github.com/sebastianbergmann/diff/issues", 822 | "source": "https://github.com/sebastianbergmann/diff/tree/1.4" 823 | }, 824 | "time": "2017-05-22T07:24:03+00:00" 825 | }, 826 | { 827 | "name": "sebastian/environment", 828 | "version": "1.3.8", 829 | "source": { 830 | "type": "git", 831 | "url": "https://github.com/sebastianbergmann/environment.git", 832 | "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" 833 | }, 834 | "dist": { 835 | "type": "zip", 836 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", 837 | "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", 838 | "shasum": "" 839 | }, 840 | "require": { 841 | "php": "^5.3.3 || ^7.0" 842 | }, 843 | "require-dev": { 844 | "phpunit/phpunit": "^4.8 || ^5.0" 845 | }, 846 | "type": "library", 847 | "extra": { 848 | "branch-alias": { 849 | "dev-master": "1.3.x-dev" 850 | } 851 | }, 852 | "autoload": { 853 | "classmap": [ 854 | "src/" 855 | ] 856 | }, 857 | "notification-url": "https://packagist.org/downloads/", 858 | "license": [ 859 | "BSD-3-Clause" 860 | ], 861 | "authors": [ 862 | { 863 | "name": "Sebastian Bergmann", 864 | "email": "sebastian@phpunit.de" 865 | } 866 | ], 867 | "description": "Provides functionality to handle HHVM/PHP environments", 868 | "homepage": "http://www.github.com/sebastianbergmann/environment", 869 | "keywords": [ 870 | "Xdebug", 871 | "environment", 872 | "hhvm" 873 | ], 874 | "support": { 875 | "issues": "https://github.com/sebastianbergmann/environment/issues", 876 | "source": "https://github.com/sebastianbergmann/environment/tree/1.3" 877 | }, 878 | "time": "2016-08-18T05:49:44+00:00" 879 | }, 880 | { 881 | "name": "sebastian/exporter", 882 | "version": "1.2.2", 883 | "source": { 884 | "type": "git", 885 | "url": "https://github.com/sebastianbergmann/exporter.git", 886 | "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" 887 | }, 888 | "dist": { 889 | "type": "zip", 890 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", 891 | "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", 892 | "shasum": "" 893 | }, 894 | "require": { 895 | "php": ">=5.3.3", 896 | "sebastian/recursion-context": "~1.0" 897 | }, 898 | "require-dev": { 899 | "ext-mbstring": "*", 900 | "phpunit/phpunit": "~4.4" 901 | }, 902 | "type": "library", 903 | "extra": { 904 | "branch-alias": { 905 | "dev-master": "1.3.x-dev" 906 | } 907 | }, 908 | "autoload": { 909 | "classmap": [ 910 | "src/" 911 | ] 912 | }, 913 | "notification-url": "https://packagist.org/downloads/", 914 | "license": [ 915 | "BSD-3-Clause" 916 | ], 917 | "authors": [ 918 | { 919 | "name": "Jeff Welch", 920 | "email": "whatthejeff@gmail.com" 921 | }, 922 | { 923 | "name": "Volker Dusch", 924 | "email": "github@wallbash.com" 925 | }, 926 | { 927 | "name": "Bernhard Schussek", 928 | "email": "bschussek@2bepublished.at" 929 | }, 930 | { 931 | "name": "Sebastian Bergmann", 932 | "email": "sebastian@phpunit.de" 933 | }, 934 | { 935 | "name": "Adam Harvey", 936 | "email": "aharvey@php.net" 937 | } 938 | ], 939 | "description": "Provides the functionality to export PHP variables for visualization", 940 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 941 | "keywords": [ 942 | "export", 943 | "exporter" 944 | ], 945 | "support": { 946 | "issues": "https://github.com/sebastianbergmann/exporter/issues", 947 | "source": "https://github.com/sebastianbergmann/exporter/tree/master" 948 | }, 949 | "time": "2016-06-17T09:04:28+00:00" 950 | }, 951 | { 952 | "name": "sebastian/global-state", 953 | "version": "1.1.1", 954 | "source": { 955 | "type": "git", 956 | "url": "https://github.com/sebastianbergmann/global-state.git", 957 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" 958 | }, 959 | "dist": { 960 | "type": "zip", 961 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", 962 | "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", 963 | "shasum": "" 964 | }, 965 | "require": { 966 | "php": ">=5.3.3" 967 | }, 968 | "require-dev": { 969 | "phpunit/phpunit": "~4.2" 970 | }, 971 | "suggest": { 972 | "ext-uopz": "*" 973 | }, 974 | "type": "library", 975 | "extra": { 976 | "branch-alias": { 977 | "dev-master": "1.0-dev" 978 | } 979 | }, 980 | "autoload": { 981 | "classmap": [ 982 | "src/" 983 | ] 984 | }, 985 | "notification-url": "https://packagist.org/downloads/", 986 | "license": [ 987 | "BSD-3-Clause" 988 | ], 989 | "authors": [ 990 | { 991 | "name": "Sebastian Bergmann", 992 | "email": "sebastian@phpunit.de" 993 | } 994 | ], 995 | "description": "Snapshotting of global state", 996 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 997 | "keywords": [ 998 | "global state" 999 | ], 1000 | "support": { 1001 | "issues": "https://github.com/sebastianbergmann/global-state/issues", 1002 | "source": "https://github.com/sebastianbergmann/global-state/tree/1.1.1" 1003 | }, 1004 | "time": "2015-10-12T03:26:01+00:00" 1005 | }, 1006 | { 1007 | "name": "sebastian/recursion-context", 1008 | "version": "1.0.5", 1009 | "source": { 1010 | "type": "git", 1011 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1012 | "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" 1013 | }, 1014 | "dist": { 1015 | "type": "zip", 1016 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", 1017 | "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", 1018 | "shasum": "" 1019 | }, 1020 | "require": { 1021 | "php": ">=5.3.3" 1022 | }, 1023 | "require-dev": { 1024 | "phpunit/phpunit": "~4.4" 1025 | }, 1026 | "type": "library", 1027 | "extra": { 1028 | "branch-alias": { 1029 | "dev-master": "1.0.x-dev" 1030 | } 1031 | }, 1032 | "autoload": { 1033 | "classmap": [ 1034 | "src/" 1035 | ] 1036 | }, 1037 | "notification-url": "https://packagist.org/downloads/", 1038 | "license": [ 1039 | "BSD-3-Clause" 1040 | ], 1041 | "authors": [ 1042 | { 1043 | "name": "Jeff Welch", 1044 | "email": "whatthejeff@gmail.com" 1045 | }, 1046 | { 1047 | "name": "Sebastian Bergmann", 1048 | "email": "sebastian@phpunit.de" 1049 | }, 1050 | { 1051 | "name": "Adam Harvey", 1052 | "email": "aharvey@php.net" 1053 | } 1054 | ], 1055 | "description": "Provides functionality to recursively process PHP variables", 1056 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1057 | "support": { 1058 | "issues": "https://github.com/sebastianbergmann/recursion-context/issues", 1059 | "source": "https://github.com/sebastianbergmann/recursion-context/tree/master" 1060 | }, 1061 | "time": "2016-10-03T07:41:43+00:00" 1062 | }, 1063 | { 1064 | "name": "sebastian/version", 1065 | "version": "1.0.6", 1066 | "source": { 1067 | "type": "git", 1068 | "url": "https://github.com/sebastianbergmann/version.git", 1069 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" 1070 | }, 1071 | "dist": { 1072 | "type": "zip", 1073 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 1074 | "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", 1075 | "shasum": "" 1076 | }, 1077 | "type": "library", 1078 | "autoload": { 1079 | "classmap": [ 1080 | "src/" 1081 | ] 1082 | }, 1083 | "notification-url": "https://packagist.org/downloads/", 1084 | "license": [ 1085 | "BSD-3-Clause" 1086 | ], 1087 | "authors": [ 1088 | { 1089 | "name": "Sebastian Bergmann", 1090 | "email": "sebastian@phpunit.de", 1091 | "role": "lead" 1092 | } 1093 | ], 1094 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1095 | "homepage": "https://github.com/sebastianbergmann/version", 1096 | "support": { 1097 | "issues": "https://github.com/sebastianbergmann/version/issues", 1098 | "source": "https://github.com/sebastianbergmann/version/tree/1.0.6" 1099 | }, 1100 | "time": "2015-06-21T13:59:46+00:00" 1101 | }, 1102 | { 1103 | "name": "symfony/polyfill-ctype", 1104 | "version": "v1.19.0", 1105 | "source": { 1106 | "type": "git", 1107 | "url": "https://github.com/symfony/polyfill-ctype.git", 1108 | "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b" 1109 | }, 1110 | "dist": { 1111 | "type": "zip", 1112 | "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/aed596913b70fae57be53d86faa2e9ef85a2297b", 1113 | "reference": "aed596913b70fae57be53d86faa2e9ef85a2297b", 1114 | "shasum": "" 1115 | }, 1116 | "require": { 1117 | "php": ">=5.3.3" 1118 | }, 1119 | "suggest": { 1120 | "ext-ctype": "For best performance" 1121 | }, 1122 | "type": "library", 1123 | "extra": { 1124 | "branch-alias": { 1125 | "dev-main": "1.19-dev" 1126 | }, 1127 | "thanks": { 1128 | "name": "symfony/polyfill", 1129 | "url": "https://github.com/symfony/polyfill" 1130 | } 1131 | }, 1132 | "autoload": { 1133 | "files": [ 1134 | "bootstrap.php" 1135 | ], 1136 | "psr-4": { 1137 | "Symfony\\Polyfill\\Ctype\\": "" 1138 | } 1139 | }, 1140 | "notification-url": "https://packagist.org/downloads/", 1141 | "license": [ 1142 | "MIT" 1143 | ], 1144 | "authors": [ 1145 | { 1146 | "name": "Gert de Pagter", 1147 | "email": "BackEndTea@gmail.com" 1148 | }, 1149 | { 1150 | "name": "Symfony Community", 1151 | "homepage": "https://symfony.com/contributors" 1152 | } 1153 | ], 1154 | "description": "Symfony polyfill for ctype functions", 1155 | "homepage": "https://symfony.com", 1156 | "keywords": [ 1157 | "compatibility", 1158 | "ctype", 1159 | "polyfill", 1160 | "portable" 1161 | ], 1162 | "support": { 1163 | "source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0" 1164 | }, 1165 | "funding": [ 1166 | { 1167 | "url": "https://symfony.com/sponsor", 1168 | "type": "custom" 1169 | }, 1170 | { 1171 | "url": "https://github.com/fabpot", 1172 | "type": "github" 1173 | }, 1174 | { 1175 | "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", 1176 | "type": "tidelift" 1177 | } 1178 | ], 1179 | "time": "2020-10-23T09:01:57+00:00" 1180 | }, 1181 | { 1182 | "name": "symfony/yaml", 1183 | "version": "v2.8.52", 1184 | "source": { 1185 | "type": "git", 1186 | "url": "https://github.com/symfony/yaml.git", 1187 | "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" 1188 | }, 1189 | "dist": { 1190 | "type": "zip", 1191 | "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b", 1192 | "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", 1193 | "shasum": "" 1194 | }, 1195 | "require": { 1196 | "php": ">=5.3.9", 1197 | "symfony/polyfill-ctype": "~1.8" 1198 | }, 1199 | "type": "library", 1200 | "extra": { 1201 | "branch-alias": { 1202 | "dev-master": "2.8-dev" 1203 | } 1204 | }, 1205 | "autoload": { 1206 | "psr-4": { 1207 | "Symfony\\Component\\Yaml\\": "" 1208 | }, 1209 | "exclude-from-classmap": [ 1210 | "/Tests/" 1211 | ] 1212 | }, 1213 | "notification-url": "https://packagist.org/downloads/", 1214 | "license": [ 1215 | "MIT" 1216 | ], 1217 | "authors": [ 1218 | { 1219 | "name": "Fabien Potencier", 1220 | "email": "fabien@symfony.com" 1221 | }, 1222 | { 1223 | "name": "Symfony Community", 1224 | "homepage": "https://symfony.com/contributors" 1225 | } 1226 | ], 1227 | "description": "Symfony Yaml Component", 1228 | "homepage": "https://symfony.com", 1229 | "support": { 1230 | "source": "https://github.com/symfony/yaml/tree/v2.8.52" 1231 | }, 1232 | "time": "2018-11-11T11:18:13+00:00" 1233 | }, 1234 | { 1235 | "name": "webmozart/assert", 1236 | "version": "1.9.1", 1237 | "source": { 1238 | "type": "git", 1239 | "url": "https://github.com/webmozarts/assert.git", 1240 | "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" 1241 | }, 1242 | "dist": { 1243 | "type": "zip", 1244 | "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", 1245 | "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", 1246 | "shasum": "" 1247 | }, 1248 | "require": { 1249 | "php": "^5.3.3 || ^7.0 || ^8.0", 1250 | "symfony/polyfill-ctype": "^1.8" 1251 | }, 1252 | "conflict": { 1253 | "phpstan/phpstan": "<0.12.20", 1254 | "vimeo/psalm": "<3.9.1" 1255 | }, 1256 | "require-dev": { 1257 | "phpunit/phpunit": "^4.8.36 || ^7.5.13" 1258 | }, 1259 | "type": "library", 1260 | "autoload": { 1261 | "psr-4": { 1262 | "Webmozart\\Assert\\": "src/" 1263 | } 1264 | }, 1265 | "notification-url": "https://packagist.org/downloads/", 1266 | "license": [ 1267 | "MIT" 1268 | ], 1269 | "authors": [ 1270 | { 1271 | "name": "Bernhard Schussek", 1272 | "email": "bschussek@gmail.com" 1273 | } 1274 | ], 1275 | "description": "Assertions to validate method input/output with nice error messages.", 1276 | "keywords": [ 1277 | "assert", 1278 | "check", 1279 | "validate" 1280 | ], 1281 | "support": { 1282 | "issues": "https://github.com/webmozarts/assert/issues", 1283 | "source": "https://github.com/webmozarts/assert/tree/1.9.1" 1284 | }, 1285 | "time": "2020-07-08T17:02:28+00:00" 1286 | } 1287 | ], 1288 | "aliases": [], 1289 | "minimum-stability": "stable", 1290 | "stability-flags": [], 1291 | "prefer-stable": false, 1292 | "prefer-lowest": false, 1293 | "platform": { 1294 | "php": ">=5.5" 1295 | }, 1296 | "platform-dev": [], 1297 | "plugin-api-version": "2.2.0" 1298 | } 1299 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 12 | 13 | 14 | ./src/ 15 | 16 | 17 | 18 | ./tests/ 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sample.php: -------------------------------------------------------------------------------- 1 | query()->filtered()->query()->matchAll(new stdClass()); 10 | $builder->query()->filtered()->filter()->and( 11 | [ 12 | new Term('my.nested.label', 'my_value'), 13 | new Term('my_label', 'other_value'), 14 | ] 15 | ); 16 | 17 | echo $builder.PHP_EOL; 18 | -------------------------------------------------------------------------------- /src/GeoDistance.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | class GeoDistance 20 | { 21 | /** 22 | * @var stdClass The Geo distance representation 23 | */ 24 | public $geo_distance; 25 | 26 | /** 27 | * {@inherit}. 28 | * 29 | * @param string $field The attribute name 30 | * @param string $distance The distance, eg: 20km 31 | * @param string $coordinate array("lat"=>222,"lon"=>-222) 32 | */ 33 | public function __construct($field, $distance, array $coordinate = []) 34 | { 35 | $this->geo_distance = new stdClass(); 36 | $this->geo_distance->distance = $distance; 37 | 38 | foreach ($coordinate as $name => $value) { 39 | $fieldName = "{$field}.{$name}"; 40 | $this->geo_distance->$fieldName = $value; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/NumericRange.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | class NumericRange 20 | { 21 | /** 22 | * @var stdClass The Numeric range representation 23 | */ 24 | public $range; 25 | 26 | /** 27 | * {@inherit}. 28 | * 29 | * @param string $field The attribute name 30 | * @param string $lte Less than 31 | * @param string $gte Greater than 32 | */ 33 | public function __construct($field, $lte, $gte) 34 | { 35 | $this->range = new stdClass(); 36 | $this->range->$field = new stdClass(); 37 | $this->range->$field->to = (int) $lte; 38 | $this->range->$field->from = (int) $gte; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Query.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | class Query implements JsonSerializable 21 | { 22 | /** 23 | * @var array 24 | */ 25 | private $properties = []; 26 | 27 | /** 28 | * Create nested objects and set its value. 29 | * 30 | * @param string $field The attribute 31 | * @param mixed $value The value 32 | * 33 | * @return Query $this->$field; 34 | */ 35 | public function __call($field, $value) 36 | { 37 | $data = new self(); 38 | if (count($value) > 0) { 39 | $data = $value[0]; 40 | } 41 | 42 | $field = preg_replace_callback( 43 | '/[A-Z]/', 44 | function ($match) { 45 | return '_'.strtolower($match[0]); 46 | }, 47 | $field 48 | ); 49 | 50 | if (!isset($this->properties[$field])) { 51 | $this->properties[$field] = $data; 52 | } 53 | 54 | return $this->properties[$field]; 55 | } 56 | 57 | /** 58 | * @return stdClass 59 | */ 60 | public function jsonSerialize() 61 | { 62 | $data = new stdClass(); 63 | foreach ($this->properties as $name => $value) { 64 | if ($value instanceof self) { 65 | $value = $value->jsonSerialize(); 66 | } 67 | 68 | $data->$name = $value; 69 | } 70 | 71 | return $data; 72 | } 73 | 74 | /** 75 | * Serialize to JSON. 76 | * 77 | * @return string $this 78 | */ 79 | public function __toString() 80 | { 81 | return json_encode($this); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Term.php: -------------------------------------------------------------------------------- 1 | 18 | */ 19 | class Term 20 | { 21 | /** 22 | * @var stdClass The input representation 23 | */ 24 | public $term; 25 | 26 | /** 27 | * {@inherit}. 28 | * 29 | * @param string $label The attribute name 30 | * @param mixed $value The attribute value 31 | */ 32 | public function __construct($label, $value) 33 | { 34 | $this->term = new stdClass(); 35 | $this->term->$label = $value; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/QueryTest.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class QueryTest extends \PHPUnit_Framework_TestCase 18 | { 19 | /** 20 | * @var \PHPFluent\ElasticQueryBuilder\Query 21 | */ 22 | private $queryBuilder; 23 | 24 | /** 25 | * {@inherit}. 26 | */ 27 | public function setUp() 28 | { 29 | $this->queryBuilder = new \PHPFluent\ElasticQueryBuilder\Query(); 30 | 31 | parent::setUp(); 32 | } 33 | 34 | /** 35 | * Should create an empty json. 36 | */ 37 | public function testShouldCreateAnEmptyJson() 38 | { 39 | $this->assertEquals('{}', (string) $this->queryBuilder); 40 | } 41 | 42 | /** 43 | * Should create an empty json. 44 | */ 45 | public function testShouldSerializeAsJson() 46 | { 47 | $queryBuilder = clone $this->queryBuilder; 48 | $queryBuilder->query()->filtered()->query()->match_all(new \stdClass()); 49 | 50 | $this->assertEquals('{"query":{"filtered":{"query":{"match_all":{}}}}}', json_encode($queryBuilder)); 51 | } 52 | 53 | /** 54 | * Should create an empty json. 55 | */ 56 | public function testShouldConvertCammelCaseToUndescore() 57 | { 58 | $queryBuilder = clone $this->queryBuilder; 59 | $queryBuilder->query()->matchAll(new \stdClass()); 60 | 61 | $this->assertEquals('{"query":{"match_all":{}}}', json_encode($queryBuilder)); 62 | } 63 | 64 | /** 65 | * Should create a complex json. 66 | */ 67 | public function testShouldCreateComplexJson() 68 | { 69 | $queryBuilder = clone $this->queryBuilder; 70 | $queryBuilder->query()->filtered()->query()->match_all(new \stdClass()); 71 | 72 | $this->assertEquals('{"query":{"filtered":{"query":{"match_all":{}}}}}', (string) $queryBuilder); 73 | } 74 | 75 | /** 76 | * Test functionally with Term. 77 | */ 78 | public function testShouldCreateAnElasticQuery() 79 | { 80 | $queryBuilder = clone $this->queryBuilder; 81 | $queryBuilder->query()->filtered()->query()->match_all(new \stdClass()); 82 | $queryBuilder->query()->filtered()->filter()->and( 83 | [ 84 | new \PHPFluent\ElasticQueryBuilder\Term('my.nested.label', 'my_value'), 85 | new \PHPFluent\ElasticQueryBuilder\Term('my_label', 'other_value'), 86 | ] 87 | ); 88 | 89 | $expectedJson = '{"query":{"filtered":{"query":{"match_all":{}},"filter":{"and":[{"term":{"my.nested.label":"my_value"}},{"term":{"my_label":"other_value"}}]}}}}'; 90 | 91 | $this->assertEquals($expectedJson, (string) $queryBuilder); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /tests/TermTest.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | class TermTest extends \PHPUnit_Framework_TestCase 18 | { 19 | /** 20 | * Should create a term. 21 | */ 22 | public function testShouldCreateATerm() 23 | { 24 | $term = new \PHPFluent\ElasticQueryBuilder\Term('Foo', 'Bar'); 25 | 26 | $this->assertEquals('{"term":{"Foo":"Bar"}}', json_encode($term)); 27 | } 28 | } 29 | --------------------------------------------------------------------------------