DiscordPHP-MTG Documentation

Endpoint
in package
implements EndpointInterface uses EndpointTrait

The route table for the MTGJSON v5 API — one constant per file the API serves under `https://mtgjson.com/api/v5/`, with `:param` placeholders bound via {@see EndpointTrait}. Same mechanics as DiscordPHP's own `Endpoint`, pointed at `mtgjson.com`.

MTGJSON is a file API: every route is a static JSON document wrapped as {"meta": {...}, "data": ...}, rebuilt daily. The bulk files (marked below) run from tens to hundreds of megabytes; card and set queries are answered from the SQLite build instead (see Database).

Tags
link

All files

The API root

see
EndpointInterface

The contract this implements

since
0.1.0

Table of Contents

Interfaces

EndpointInterface

Constants

ALL_IDENTIFIERS  : mixed = 'AllIdentifiers.json'
ALL_PRICES  : mixed = 'AllPrices.json'
ALL_PRICES_TODAY  : mixed = 'AllPricesToday.json'
ALL_PRINTINGS  : mixed = 'AllPrintings.json'
ALL_PRINTINGS_SQLITE_GZ  : mixed = 'AllPrintings.sqlite.gz'
ATOMIC_CARDS  : mixed = 'AtomicCards.json'
CARD_TYPES  : mixed = 'CardTypes.json'
COMPILED_LIST  : mixed = 'CompiledList.json'
DECK  : mixed = 'decks/:file_name.json'
DECK_LIST  : mixed = 'DeckList.json'
ENUM_VALUES  : mixed = 'EnumValues.json'
FORMAT  : mixed = ':format.json'
KEYWORDS  : mixed = 'Keywords.json'
META  : mixed = 'Meta.json'
REGEX  : string = '/:([A-Za-z0-9_]+)/'
Regex to identify parameters in endpoints. Stops at `.` so that `:code.json` binds `code`, not `code.json`.
SET  : mixed = ':code.json'
SET_LIST  : mixed = 'SetList.json'
TCGPLAYER_SKUS  : mixed = 'TcgplayerSkus.json'

Properties

$args  : array<string|int, string>
Array of arguments to substitute into the endpoint.
$endpoint  : string
The string version of the endpoint, including all parameters.
$query  : array<string|int, mixed>
Array of query data to be appended to the end of the endpoint with `http_build_query`.
$vars  : array<string|int, string>
Array of placeholders to be replaced in the endpoint.

Methods

__construct()  : mixed
Creates an endpoint class.

Constants

ALL_IDENTIFIERS

public mixed ALL_IDENTIFIERS = 'AllIdentifiers.json'

ALL_PRICES

public mixed ALL_PRICES = 'AllPrices.json'

ALL_PRICES_TODAY

public mixed ALL_PRICES_TODAY = 'AllPricesToday.json'

ALL_PRINTINGS

public mixed ALL_PRINTINGS = 'AllPrintings.json'

ALL_PRINTINGS_SQLITE_GZ

public mixed ALL_PRINTINGS_SQLITE_GZ = 'AllPrintings.sqlite.gz'

ATOMIC_CARDS

public mixed ATOMIC_CARDS = 'AtomicCards.json'

CARD_TYPES

public mixed CARD_TYPES = 'CardTypes.json'

COMPILED_LIST

public mixed COMPILED_LIST = 'CompiledList.json'

DECK

public mixed DECK = 'decks/:file_name.json'

DECK_LIST

public mixed DECK_LIST = 'DeckList.json'

ENUM_VALUES

public mixed ENUM_VALUES = 'EnumValues.json'

FORMAT

public mixed FORMAT = ':format.json'

KEYWORDS

public mixed KEYWORDS = 'Keywords.json'

REGEX

Regex to identify parameters in endpoints. Stops at `.` so that `:code.json` binds `code`, not `code.json`.

public string REGEX = '/:([A-Za-z0-9_]+)/'

SET_LIST

public mixed SET_LIST = 'SetList.json'

TCGPLAYER_SKUS

public mixed TCGPLAYER_SKUS = 'TcgplayerSkus.json'

Properties

$args

Array of arguments to substitute into the endpoint.

protected array<string|int, string> $args = []

$endpoint

The string version of the endpoint, including all parameters.

protected string $endpoint

$query

Array of query data to be appended to the end of the endpoint with `http_build_query`.

protected array<string|int, mixed> $query = []

$vars

Array of placeholders to be replaced in the endpoint.

protected array<string|int, string> $vars = []

Methods

__construct()

Creates an endpoint class.

public __construct(string $endpoint) : mixed
Parameters
$endpoint : string
On this page

Search results