magiclegacy/search-client
Composer 安装命令:
composer require magiclegacy/search-client
包简介
Search Client for magic card in ElasticSearch engine
README 文档
README
Search Client for magic card in ElasticSearch engine
Supported search (related to Atomic Card from mtgjson.org, with some minor field renaming):
/atomic/_search: ElasticSearch index with nameatomicfor all atomics cards
Composer
composer require magiclegacy/search-client
Usage in application
<?php namespace Application; use MagicLegacy\Component\Search\Client\SearchClient; use Eureka\Component\Curl; use Nyholm\Psr7\Factory\Psr17Factory; use Psr\Log\NullLogger; require_once __DIR__ . '/../vendor/autoload.php'; //~ Declare tier required services (included as dependencies) $httpFactory = new Psr17Factory(); $searchClient = new SearchClient( new Curl\HttpClient(), $httpFactory, $httpFactory, $httpFactory, new NullLogger() ); $cards = $searchClient->searchAtomicCards('name:llanowar types:creature power:1 OR power:2'); foreach ($cards as $card) { echo (string) $card->getName() . ' - ' . $card->getPower() . '/' . $card->getToughness() . PHP_EOL; }
see: example.php
The output will be:
Llanowar Cavalry - 1/4
Llanowar Druid - 1/2
Llanowar Elite - 1/1
Llanowar Elves - 1/1
Llanowar Mentor - 1/1
Llanowar Scout - 1/3
Llanowar Vanguard - 1/1
Llanowar Dead - 2/2
Llanowar Empath - 2/2
Llanowar Knight - 2/2
SearchClient
About Atomic Cards
Available methods:
SearchClient::searchAtomicCards():AtomicCard[]
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-17