PHP code example of gdbots / query-parser
1. Go to this page and download the library: Download gdbots/query-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gdbots / query-parser example snippets
php
use Gdbots\QueryParser\QueryParser;
use Gdbots\QueryParser\Builder\XmlQueryBuilder;
$parser = new QueryParser();
$builder = (new XmlQueryBuilder())->setHashtagFieldName('tags');
$result = $parser->parse('hello^5 planet:earth +date:2015-12-25 #omg');
echo $builder->addParsedQuery($result)->toXmlString();
php
use Gdbots\QueryParser\Node\Hashtag;
$result = $parser->parse('#hashtag1 AND #hashtag2');
$hashtags = $result->getNodesOfType(Hashtag::NODE_TYPE);