Card
extends Part
in package
One face of one printing of a Magic: The Gathering card — MTGJSON's Card (Set) model, plus the Card (Deck) fields when it comes from a deck.
Multi-face cards (split, transform, modal DFC, adventure, …) have one Card
per face, sharing name and told apart by faceName and side.
Tags
Table of Contents
Constants
- DOUBLE_FACED_LAYOUTS : array<string|int, string> = ['transform', 'modal_dfc', 'reversible_card', '...
- Layouts whose later sides are printed on the back of the same card.
- IMAGE_SIZE : string = 'normal'
- The Scryfall image size used for `image_url`.
- MAX_CONTENT_LENGTH : int = 2000
- Discord's limit on a message's content.
- VISUAL_LAYOUTS : array<string|int, string> = ['planar', 'scheme', 'vanguard', 'token', 'doub...
- Layouts that only render well as an image.
Properties
- $artist : string|null
- $artistIds : array<string|int, string>|null
- $asciiName : string|null
- $attractionLights : array<string|int, string>|null
- $availability : array<string|int, string>|null
- $boosterTypes : array<string|int, string>|null
- $borderColor : string|null
- $cardParts : string|null
- $colorIdentity : array<string|int, string>|null
- $colorIndicator : array<string|int, string>|null
- $colors : array<string|int, string>|null
- $count : int|null
- $defense : string|null
- $duelDeck : string|null
- $edhrecRank : int|null
- $edhrecSaltiness : float|null
- $faceConvertedManaCost : float|null
- $faceFlavorName : string|null
- $faceManaValue : float|null
- $faceName : string|null
- $facePrintedName : string|null
- $finishes : array<string|int, string>|null
- $flavorName : string|null
- $flavorText : string|null
- $foreignData : ExCollectionInterface<string|int, ForeignData>
- $frameEffects : array<string|int, string>|null
- $frameVersion : string|null
- $hand : string|null
- $hasAlternativeDeckLimit : bool|null
- $hasContentWarning : bool|null
- $identifiers : Identifiers|null
- $image_embed : Embed|null
- $image_url : string|null
- $isAlternative : bool|null
- $isEtched : bool|null
- $isFoil : bool|null
- $isFullArt : bool|null
- $isFunny : bool|null
- $isGameChanger : bool|null
- $isOnlineOnly : bool|null
- $isOversized : bool|null
- $isPromo : bool|null
- $isRebalanced : bool|null
- $isReprint : bool|null
- $isReserved : bool|null
- $isStorySpotlight : bool|null
- $isTextless : bool|null
- $isTimeshifted : bool|null
- $keywords : array<string|int, string>|null
- $language : string|null
- $layout : string|null
- $leadershipSkills : LeadershipSkills|null
- $legalities : ExCollectionInterface<string|int, Legality>
- $life : string|null
- $loyalty : string|null
- $manaCost : string|null
- $manaValue : float|null
- $name : string|null
- $number : string|null
- $originalPrintings : array<string|int, string>|null
- $originalReleaseDate : Carbon|null
- $originalText : string|null
- $originalType : string|null
- $otherFaceIds : array<string|int, string>|null
- $power : string|null
- $prices : array<string|int, mixed>|null
- $printedName : string|null
- $printedText : string|null
- $printedType : string|null
- $printings : array<string|int, string>|null
- $producedMana : array<string|int, string>|null
- $promoTypes : array<string|int, string>|null
- $purchaseUrls : PurchaseUrls|null
- $rarity : string|null
- $rebalancedPrintings : array<string|int, string>|null
- $relatedCards : array<string|int, mixed>|null
- $rulings : ExCollectionInterface<string|int, Ruling>
- $securityStamp : string|null
- $setCode : string|null
- $setName : string|null
- $side : string|null
- $signature : string|null
- $skuIds : array<string|int, mixed>|null
- $sourceProducts : array<string|int, mixed>|null
- $subsets : string|null
- $subtypes : array<string|int, string>|null
- $supertypes : array<string|int, string>|null
- $text : string|null
- $toughness : string|null
- $type : string|null
- $types : array<string|int, string>|null
- $uuid : string|null
- $variations : array<string|int, string>|null
- $watermark : string|null
- $fillable : mixed
- $visible : mixed
Methods
- getForeignNamesButton() : Button|null
- Gets a button to view the foreign names for the card.
- getJsonButton() : Button
- Gets a button to view the raw JSON of the card.
- getLegalitiesButton() : Button|null
- Gets a button to view the legal formats for the card.
- getPrice() : float|null
- Today's price at one store, or null when it has none.
- getPriceCurrency() : string|null
- The currency a store prices in (`USD`, `EUR`), or null when it has no price.
- getRulingsButton() : Button|null
- Builds a button that, when clicked, replies with this card's rulings grouped by date. Returns null when the card has no rulings.
- getSetButton() : Button|null
- Gets a button to view the set the card belongs to.
- getViewImageButton() : Button|null
- Gets a button to view the image of the card.
- normalLayoutContainer() : Container
- Builds and returns a Container representing the normal layout for a Magic: The Gathering card.
- toContainer() : Container|null
- Converts the card to a container with components.
- getForeignDataAttribute() : ExCollectionInterface<string|int, ForeignData>
- Gets the card's printed names and text in other languages.
- getIdentifiersAttribute() : Identifiers|null
- Gets the card's identifiers on other services.
- getImageEmbedAttribute() : Embed|null
- Generates an Embed object for the card's image.
- getImageUrlAttribute() : string|null
- Gets the card face's image on Scryfall's CDN. The back face of a double-faced card shares its front's Scryfall id.
- getLeadershipSkillsAttribute() : LeadershipSkills|null
- Gets which formats the card can be your commander in.
- getLegalitiesAttribute() : ExCollectionInterface<string|int, Legality>
- Gets the card's status in each format it has one in. MTGJSON keys legalities by format; each entry becomes a {@see Legality}.
- getOriginalReleaseDateAttribute() : Carbon|null
- Gets the original release date of a promotional printing.
- getPurchaseUrlsAttribute() : PurchaseUrls|null
- Gets links to buy the card.
- getRulingsAttribute() : ExCollectionInterface<string|int, Ruling>
- Gets the official rulings on the card.
- listOf() : ExCollectionInterface
- Builds a collection of parts from a list attribute.
- textButton() : Button
- A button that replies with a block of text — as a file when it is longer than a message can hold.
Constants
DOUBLE_FACED_LAYOUTS
Layouts whose later sides are printed on the back of the same card.
public
array<string|int, string>
DOUBLE_FACED_LAYOUTS
= ['transform', 'modal_dfc', 'reversible_card', 'double_faced_token', 'art_series']
IMAGE_SIZE
The Scryfall image size used for `image_url`.
public
string
IMAGE_SIZE
= 'normal'
MAX_CONTENT_LENGTH
Discord's limit on a message's content.
public
int
MAX_CONTENT_LENGTH
= 2000
VISUAL_LAYOUTS
Layouts that only render well as an image.
public
array<string|int, string>
VISUAL_LAYOUTS
= ['planar', 'scheme', 'vanguard', 'token', 'double_faced_token', 'emblem', 'art_series']
Properties
$artist
public
string|null
$artist
Name of the artist that illustrated the card art.
$artistIds
public
array<string|int, string>|null
$artistIds
Identifiers of the artists.
$asciiName
public
string|null
$asciiName
The ASCII (Basic/128) code formatted card name with no special unicode characters.
$attractionLights
public
array<string|int, string>|null
$attractionLights
A list of attraction lights found on a card, available only to "Attraction" subtypes.
$availability
public
array<string|int, string>|null
$availability
A list of the card's available printing types (arena, dreamcast, mtgo, paper, shandalar).
$boosterTypes
public
array<string|int, string>|null
$boosterTypes
The types of booster packs the card is found in (default, deck).
$borderColor
public
string|null
$borderColor
The color of the card border (black, borderless, gold, silver, white).
$cardParts
public
string|null
$cardParts
The names of the cards that meld into this card (comma-joined in the SQLite build).
$colorIdentity
public
array<string|int, string>|null
$colorIdentity
A list of all the colors found in manaCost, colorIndicator and text, as letters (W, U, B, R, G).
$colorIndicator
public
array<string|int, string>|null
$colorIndicator
A list of the colors of the color indicator, as letters.
$colors
public
array<string|int, string>|null
$colors
A list of all the colors in manaCost and colorIndicator, as letters.
$count
public
int|null
$count
The count of how many of this card exists in a relevant deck (Card (Deck) only).
$defense
public
string|null
$defense
The defense of the card. Used on battle cards.
$duelDeck
public
string|null
$duelDeck
The duel deck the card is in (a or b).
$edhrecRank
public
int|null
$edhrecRank
The card rank on EDHRec.
$edhrecSaltiness
public
float|null
$edhrecSaltiness
The card saltiness score on EDHRec.
$faceConvertedManaCost
public
float|null
$faceConvertedManaCost
The converted mana cost of the face of either half or part of the card. Deprecated by MTGJSON; use faceManaValue.
$faceFlavorName
public
string|null
$faceFlavorName
The flavor name on the face of the card.
$faceManaValue
public
float|null
$faceManaValue
The mana value of the face of either half or part of the card.
$faceName
public
string|null
$faceName
The name on the face of the card.
$facePrintedName
public
string|null
$facePrintedName
The name on the face of the card as printed.
$finishes
public
array<string|int, string>|null
$finishes
The finishes of the card (etched, foil, nonfoil, signed).
$flavorName
public
string|null
$flavorName
The promotional card name printed above the true card name on special cards that has no game function.
$flavorText
public
string|null
$flavorText
The italicized text found below the rules text that has no game function.
$foreignData read-only
public
ExCollectionInterface<string|int, ForeignData>
$foreignData
The card's printed names and text in other languages.
$frameEffects
public
array<string|int, string>|null
$frameEffects
The visual frame effects (colorshifted, extendedart, legendary, showcase, …).
$frameVersion
public
string|null
$frameVersion
The version of the card frame style (1993, 1997, 2003, 2015, future).
$hand
public
string|null
$hand
The starting maximum hand size total modifier. A + or - character precedes an integer.
$hasAlternativeDeckLimit
public
bool|null
$hasAlternativeDeckLimit
If the card allows a value other than 4 copies in a deck.
$hasContentWarning
public
bool|null
$hasContentWarning
If the card marked by Wizards of the Coast for having sensitive content.
$identifiers read-only
public
Identifiers|null
$identifiers
The card's identifiers on other services.
$image_embed read-only
public
Embed|null
$image_embed
The card image as an embed, or null when the card has no Scryfall id.
$image_url read-only
public
string|null
$image_url
The card face's image on Scryfall's CDN, from identifiers.scryfallId.
$isAlternative
public
bool|null
$isAlternative
If the card has some kind of alternative variation to its printed counterpart.
$isEtched
public
bool|null
$isEtched
If the card is etched in a deck (Card (Deck) only).
$isFoil
public
bool|null
$isFoil
If the card is foil in a deck, or came from a foil booster sheet.
$isFullArt
public
bool|null
$isFullArt
If the card has full artwork.
$isFunny
public
bool|null
$isFunny
If the card is part of a funny set, such as an Un-set.
$isGameChanger
public
bool|null
$isGameChanger
If the card is on the Commander Game Changers list.
$isOnlineOnly
public
bool|null
$isOnlineOnly
If the card is only available in online game variations.
$isOversized
public
bool|null
$isOversized
If the card is oversized.
$isPromo
public
bool|null
$isPromo
If the card is a promotional printing.
$isRebalanced
public
bool|null
$isRebalanced
If the card is rebalanced for the Alchemy play format.
$isReprint
public
bool|null
$isReprint
If the card has been reprinted.
$isReserved
public
bool|null
$isReserved
If the card is on the Magic: The Gathering Reserved List.
$isStorySpotlight
public
bool|null
$isStorySpotlight
If the card is a Story Spotlight card.
$isTextless
public
bool|null
$isTextless
If the card does not have a text box.
$isTimeshifted
public
bool|null
$isTimeshifted
If the card is "timeshifted", a feature of certain sets where a card has a different frameVersion.
$keywords
public
array<string|int, string>|null
$keywords
A list of keywords found on the card.
$language
public
string|null
$language
The language the card is printed in.
$layout
public
string|null
$layout
The type of card layout (normal, split, flip, transform, modal_dfc, meld, adventure, saga, class, …).
$leadershipSkills read-only
public
LeadershipSkills|null
$leadershipSkills
Which formats the card can be your commander in.
$legalities read-only
public
ExCollectionInterface<string|int, Legality>
$legalities
The card's status in each format it has one in.
$life
public
string|null
$life
The starting life total modifier. A + or - character precedes an integer.
$loyalty
public
string|null
$loyalty
The starting loyalty value of the card. Used on planeswalker cards.
$manaCost
public
string|null
$manaCost
The mana cost of the card wrapped in brackets for each value, e.g. {1}{U}{B}{R}.
$manaValue
public
float|null
$manaValue
The total amount of mana needed to cast the card.
$name
public
string|null
$name
The name of the card. Cards with multiple faces are given all names in convention of {name} // {name}.
$number
public
string|null
$number
The number of the card. Can be prefixed or suffixed with a * or other characters for promotional sets.
$originalPrintings
public
array<string|int, string>|null
$originalPrintings
A list of card UUIDs to original printings of the card if this card is somehow different from its original.
$originalReleaseDate read-only
public
Carbon|null
$originalReleaseDate
The release date of a promotional printing outside its cycle.
$originalText
public
string|null
$originalText
The text on the card as originally printed.
$originalType
public
string|null
$originalType
The type of the card as originally printed. Includes any supertypes and subtypes.
$otherFaceIds
public
array<string|int, string>|null
$otherFaceIds
A list of card UUIDs to this card's counterparts, such as transformed or melded faces.
$power
public
string|null
$power
The power of the card.
$prices
public
array<string|int, mixed>|null
$prices
Today's prices, medium → provider → {currency, retail|buylist → finish → price}, when the price build is available.
$printedName
public
string|null
$printedName
The name of the card as printed, for non-English printings.
$printedText
public
string|null
$printedText
The text of the card as printed, for non-English printings.
$printedType
public
string|null
$printedType
The type of the card as printed, for non-English printings.
$printings
public
array<string|int, string>|null
$printings
A list of set printing codes the card was printed in, formatted in uppercase.
$producedMana
public
array<string|int, string>|null
$producedMana
A list of the colors of mana the card can produce.
$promoTypes
public
array<string|int, string>|null
$promoTypes
A list of promotional types for a card (boosterfun, buyabox, prerelease, …).
$purchaseUrls read-only
public
PurchaseUrls|null
$purchaseUrls
Links to buy the card.
$rarity
public
string|null
$rarity
The card printing rarity (common, uncommon, rare, mythic, special, bonus).
$rebalancedPrintings
public
array<string|int, string>|null
$rebalancedPrintings
A list of card UUIDs to printings that are rebalanced versions of this card.
$relatedCards
public
array<string|int, mixed>|null
$relatedCards
Raw related cards: reverseRelated names, spellbook names, tokens UUIDs.
$rulings read-only
public
ExCollectionInterface<string|int, Ruling>
$rulings
Official rulings on the card.
$securityStamp
public
string|null
$securityStamp
The security stamp printed on the card (acorn, arena, circle, heart, oval, triangle).
$setCode
public
string|null
$setCode
The printing set code that the card is from.
$setName
public
string|null
$setName
The name of the printing set (joined from the set; not an MTGJSON card field).
$side
public
string|null
$side
The identifier of the card side (a, b, c, d, e). Used on cards with multiple faces.
$signature
public
string|null
$signature
The name of the signature on the card.
$skuIds
public
array<string|int, mixed>|null
$skuIds
TCGplayer SKU identifiers, by finish.
$sourceProducts
public
array<string|int, mixed>|null
$sourceProducts
A list of sealed product UUIDs that contain this card, by finish.
$subsets
public
string|null
$subsets
The names of the subset printings a card is in (comma-joined in the SQLite build).
$subtypes
public
array<string|int, string>|null
$subtypes
A list of card subtypes found after em-dash.
$supertypes
public
array<string|int, string>|null
$supertypes
A list of card supertypes found before em-dash.
$text
public
string|null
$text
The rules text of the card.
$toughness
public
string|null
$toughness
The toughness of the card.
$type
public
string|null
$type
Type of the card as visible, including any supertypes and subtypes.
$types
public
array<string|int, string>|null
$types
A list of all card types of the card, including Un-sets and gameplay variants.
$uuid
public
string|null
$uuid
The universal unique identifier (v5) generated by MTGJSON. Each entry is unique.
$variations
public
array<string|int, string>|null
$variations
A list of card UUIDs of this card with alternate printings in the same set.
$watermark
public
string|null
$watermark
The name of the watermark on the card.
$fillable
protected
mixed
$fillable
= [
'artist',
'artistIds',
'asciiName',
'attractionLights',
'availability',
'boosterTypes',
'borderColor',
'cardParts',
'colorIdentity',
'colorIndicator',
'colors',
'defense',
'duelDeck',
'edhrecRank',
'edhrecSaltiness',
'faceConvertedManaCost',
'faceFlavorName',
'faceManaValue',
'faceName',
'facePrintedName',
'finishes',
'flavorName',
'flavorText',
'foreignData',
'frameEffects',
'frameVersion',
'hand',
'hasAlternativeDeckLimit',
'hasContentWarning',
'identifiers',
'isAlternative',
'isFullArt',
'isFunny',
'isGameChanger',
'isOnlineOnly',
'isOversized',
'isPromo',
'isRebalanced',
'isReprint',
'isReserved',
'isStorySpotlight',
'isTextless',
'isTimeshifted',
'keywords',
'language',
'layout',
'leadershipSkills',
'legalities',
'life',
'loyalty',
'manaCost',
'manaValue',
'name',
'number',
'originalPrintings',
'originalReleaseDate',
'originalText',
'originalType',
'otherFaceIds',
'power',
'printedName',
'printedText',
'printedType',
'printings',
'producedMana',
'promoTypes',
'purchaseUrls',
'rarity',
'rebalancedPrintings',
'relatedCards',
'rulings',
'securityStamp',
'setCode',
'setName',
'side',
'signature',
'skuIds',
'sourceProducts',
'subsets',
'subtypes',
'supertypes',
'text',
'toughness',
'type',
'types',
'uuid',
'variations',
'watermark',
// Card (Deck)
'count',
'isFoil',
'isEtched',
// From the price build, when it is available.
'prices',
]
Tags
$visible
protected
mixed
$visible
= ['image_url']
Tags
Methods
getForeignNamesButton()
Gets a button to view the foreign names for the card.
public
getForeignNamesButton(Interaction $interaction) : Button|null
Use CardMessageBuilder::foreignNames(), whose buttons survive restarts.
Parameters
- $interaction : Interaction
Tags
Return values
Button|nullgetJsonButton()
Gets a button to view the raw JSON of the card.
public
getJsonButton(Interaction $interaction) : Button
Use CardMessageBuilder::card() (its JSON button), whose buttons survive restarts.
Parameters
- $interaction : Interaction
Tags
Return values
ButtongetLegalitiesButton()
Gets a button to view the legal formats for the card.
public
getLegalitiesButton(Interaction $interaction) : Button|null
Use CardMessageBuilder::legalities(), whose buttons survive restarts.
Parameters
- $interaction : Interaction
Tags
Return values
Button|nullgetPrice()
Today's price at one store, or null when it has none.
public
getPrice([string $provider = 'tcgplayer' ][, string $finish = 'normal' ][, string $kind = 'retail' ]) : float|null
Parameters
- $provider : string = 'tcgplayer'
-
tcgplayer,cardkingdom,cardmarket,manapoolorcardhoarder(MTGO). - $finish : string = 'normal'
-
normal,foiloretched. - $kind : string = 'retail'
-
retail, orbuylist(what the store pays).
Tags
Return values
float|nullgetPriceCurrency()
The currency a store prices in (`USD`, `EUR`), or null when it has no price.
public
getPriceCurrency(string $provider) : string|null
Parameters
- $provider : string
Tags
Return values
string|nullgetRulingsButton()
Builds a button that, when clicked, replies with this card's rulings grouped by date. Returns null when the card has no rulings.
public
getRulingsButton(Interaction $interaction) : Button|null
Use CardMessageBuilder::rulings(), whose buttons survive restarts.
Parameters
- $interaction : Interaction
-
The interaction the button will belong to.
Return values
Button|nullgetSetButton()
Gets a button to view the set the card belongs to.
public
getSetButton([Interaction|null $interaction = null ]) : Button|null
Use CardMessageBuilder::card() (its Set button), whose buttons survive restarts.
Parameters
- $interaction : Interaction|null = null
-
The interaction to answer; without one the button is disabled.
Tags
Return values
Button|nullgetViewImageButton()
Gets a button to view the image of the card.
public
getViewImageButton(Interaction $interaction) : Button|null
Use CardMessageBuilder::card() (its Image button), whose buttons survive restarts.
Parameters
- $interaction : Interaction
Tags
Return values
Button|nullnormalLayoutContainer()
Builds and returns a Container representing the normal layout for a Magic: The Gathering card.
public
normalLayoutContainer([Interaction|null $interaction = null ]) : Container
Use CardMessageBuilder::card(), whose buttons survive restarts.
Parameters
- $interaction : Interaction|null = null
-
The interaction the container answers, for the set button.
Tags
Return values
ContainertoContainer()
Converts the card to a container with components.
public
toContainer([Interaction|null $interaction = null ]) : Container|null
Use CardMessageBuilder::card(), whose buttons survive restarts.
Parameters
- $interaction : Interaction|null = null
-
The interaction the container answers, for the set button.
Tags
Return values
Container|nullgetForeignDataAttribute()
Gets the card's printed names and text in other languages.
protected
getForeignDataAttribute() : ExCollectionInterface<string|int, ForeignData>
Tags
Return values
ExCollectionInterface<string|int, ForeignData>getIdentifiersAttribute()
Gets the card's identifiers on other services.
protected
getIdentifiersAttribute() : Identifiers|null
Tags
Return values
Identifiers|nullgetImageEmbedAttribute()
Generates an Embed object for the card's image.
protected
getImageEmbedAttribute() : Embed|null
Tags
Return values
Embed|nullgetImageUrlAttribute()
Gets the card face's image on Scryfall's CDN. The back face of a double-faced card shares its front's Scryfall id.
protected
getImageUrlAttribute() : string|null
Tags
Return values
string|nullgetLeadershipSkillsAttribute()
Gets which formats the card can be your commander in.
protected
getLeadershipSkillsAttribute() : LeadershipSkills|null
Tags
Return values
LeadershipSkills|nullgetLegalitiesAttribute()
Gets the card's status in each format it has one in. MTGJSON keys legalities by format; each entry becomes a {@see Legality}.
protected
getLegalitiesAttribute() : ExCollectionInterface<string|int, Legality>
Tags
Return values
ExCollectionInterface<string|int, Legality>getOriginalReleaseDateAttribute()
Gets the original release date of a promotional printing.
protected
getOriginalReleaseDateAttribute() : Carbon|null
Tags
Return values
Carbon|nullgetPurchaseUrlsAttribute()
Gets links to buy the card.
protected
getPurchaseUrlsAttribute() : PurchaseUrls|null
Tags
Return values
PurchaseUrls|nullgetRulingsAttribute()
Gets the official rulings on the card.
protected
getRulingsAttribute() : ExCollectionInterface<string|int, Ruling>
Tags
Return values
ExCollectionInterface<string|int, Ruling>listOf()
Builds a collection of parts from a list attribute.
protected
listOf(string $class, string $key) : ExCollectionInterface
Parameters
- $class : string
-
The part class.
- $key : string
-
The attribute.
Return values
ExCollectionInterfacetextButton()
A button that replies with a block of text — as a file when it is longer than a message can hold.
protected
textButton(Interaction $interaction, string $id, string $label, string $text, string $filename) : Button
Parameters
- $interaction : Interaction
-
The interaction to answer.
- $id : string
-
The button's custom id.
- $label : string
-
The button's label.
- $text : string
-
The reply.
- $filename : string
-
The file name used when the reply is too long.