This package is currently under construction.
Laravel Pokemontcg
This package is a simple API laravel wrapper for Pokemontcg with a sleek Model design for API routes and authentication.
Installation
You can install the package via composer:
composer require slatyo/laravel-pokemontcg
The package will automatically register its service provider.
To publish the config file to config/pokemontcg.php
run:
php artisan vendor:publish --provider="Slatyo\LaravelPokemontcg\LaravelPokemontcgServiceProvider"
Default content of config/pokemontcg.php
:
/*
* Default configuration to run the pokemontcg.io API
*/
return [
'url' => env('POKEMONTCG_API_URL', 'https://api.pokemontcg.io/v2'),
'secret' => env('POKEMONTCG_SECRET'),
];
Usage
Pokemontcg
Slatyo\LaravelPokemontcg\Pokemontcg
is the default wrapper to access everything the Pokemontcg API has to offer.
Supported Models
Cards
To access the cards model you have to call:
$cards = Pokemontcg::cards();
Find by id
Find a specific card by its id:
$cards->find('Test-111');
Search by hp ($from, $to)
Find Pokémon's based on HP:
$from = "1";
$to = "100";
$cards->hp($from, $to);
Search by name
Find Pokémon's based on their name:
$cards->name('Charizard');
Search Pokémon by Pokédex entries ($from, $to)
Find Pokémon's based on their name:
$from = "1";
$to = "151";
$cards->pokedex($from, $to);
Search by supertypes
Find Pokémon's by supertypes
and types
:
$cards->supertype('mega');
$cards->supertype('mega', 'water');
Search query
Search Pokémon's based on a query string - for more details on how the query works check out: Pokemontcg search cards.
$cards->search('name:Char*zard supertype:mega -type:fire');
Sets
To access the sets model you have to call:
$sets = Pokemontcg::sets();
Find by id
Find a specific set by its id:
$sets->find('set-name')
Search query
Search Pokémon sets based on a query string - for more details on how the query works check out: Pokemontcg search sets.
$sets->search('legalities.standard:legal');
Supertypes
To access the supertypes model you have to call:
$supertypes = Pokemontcg::supertypes();
Get all
Return all supertypes
:
$supertypes->all()
Subtypes
To access the subtypes model you have to call:
$subtypes = Pokemontcg::subtypes();
Get all
Return all subtypes
:
$subtypes->all()
Types
To access the subtypes model you have to call:
$types = Pokemontcg::types();
Get all
Return all types
:
$types->all()
Rarities
To access the rarities model you have to call:
$rarities = Pokemontcg::rarities();
Get all
Return all rarities
:
$rarities->all()
Testing
Executing the testbench:
composer test
Running PHPStan
composer stan
Running PHPStan on windows
composer stan-2g
Generate coverage reports
composer test:coverage
composer test:coverage-html
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Daniel Henze
- All Contributors
- This package was generated using the Laravel Package Boilerplate.
License
The MIT License (MIT). Please see License File for more information.