PHP code example of magiclegacy / search-client

1. Go to this page and download the library: Download magiclegacy/search-client 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/ */

    

magiclegacy / search-client example snippets



namespace Application;

use MagicLegacy\Component\Search\Client\SearchClient;
use Eureka\Component\Curl;
use Nyholm\Psr7\Factory\Psr17Factory;
use Psr\Log\NullLogger;

ory,
    $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;
}
text
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