PHP code example of slatyo / laravel-pokemontcg

1. Go to this page and download the library: Download slatyo/laravel-pokemontcg 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/ */

    

slatyo / laravel-pokemontcg example snippets




/*
 * Default configuration to run the pokemontcg.io API
 */
return [
    'url' => env('POKEMONTCG_API_URL', 'https://api.pokemontcg.io/v2'),
    'secret' => env('POKEMONTCG_SECRET'),
];


$cards = Pokemontcg::cards();

$cards->find('Test-111');

// or

use \Slatyo\LaravelPokemontcg\Facades\Card;

Card::find('Test-111');

$from = "1";
$to   = "100";
$cards->hp($from, $to);

// or

use \Slatyo\LaravelPokemontcg\Facades\Card;

Card::hp($from, $to);
Card::whereHp($from, $to); // alias

$cards->name('Charizard');

// or

use \Slatyo\LaravelPokemontcg\Facades\Card;

Card::name('Charizard');
Card::whereName('Charizard'); // alias

$from = "1";
$to   = "151";
$cards->pokedex($from, $to);

// or

use \Slatyo\LaravelPokemontcg\Facades\Card;

Card::pokedex($from, $to);
Card::wherePokedex($from, $to); // alias

$cards->supertype('mega');
$cards->supertype('mega', 'water');

// or

use \Slatyo\LaravelPokemontcg\Facades\Card;

Card::supertype('mega');
Card::supertype('mega', 'water');
Card::whereSupertype('mega'); // alias
Card::whereSupertype('mega', 'water'); // alias

$cards->search('name:Char*zard supertype:mega -type:fire');

// or

use \Slatyo\LaravelPokemontcg\Facades\Card;

Card::search('name:Char*zard supertype:mega -type:fire');

$sets = Pokemontcg::sets();

$sets->find('set-name');

// or

use \Slatyo\LaravelPokemontcg\Facades\Set;

Set::find('set-name');

$sets->search('legalities.standard:legal');

// or

use \Slatyo\LaravelPokemontcg\Facades\Set;

Set::search('legalities.standard:legal');

$supertypes = Pokemontcg::supertypes();

$supertypes->all();

// or

use \Slatyo\LaravelPokemontcg\Facades\Supertype;

Supertype::all();

$subtypes = Pokemontcg::subtypes();

$subtypes->all();

// or

use \Slatyo\LaravelPokemontcg\Facades\Subtype;

Subtype::all();

$types = Pokemontcg::types();

$types->all();

// or

use \Slatyo\LaravelPokemontcg\Facades\Type;

Type::all();

$rarities = Pokemontcg::rarities();

$rarities->all();

// or

use \Slatyo\LaravelPokemontcg\Facades\Rarity;

Rarity::all();
bash
php artisan vendor:publish --provider="Slatyo\LaravelPokemontcg\LaravelPokemontcgServiceProvider"