PHPackages                             mtgsdk/mtgsdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mtgsdk/mtgsdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mtgsdk/mtgsdk
=============

Magic: The Gathering SDK for php

498.0k↑1325%11[1 issues](https://github.com/MagicTheGathering/mtg-sdk-php/issues)PHP

Since Oct 12Pushed 7y ago6 watchersCompare

[ Source](https://github.com/MagicTheGathering/mtg-sdk-php)[ Packagist](https://packagist.org/packages/mtgsdk/mtgsdk)[ RSS](/packages/mtgsdk-mtgsdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Magic: The Gathering SDK
========================

[](#magic-the-gathering-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/34bfc7f2474e9f00c3ccc105e1821b8d8038a94abe6b0f962af6577730455f7f/68747470733a2f2f706f7365722e707567782e6f72672f6d746773646b2f6d746773646b2f762f737461626c65)](https://packagist.org/packages/mtgsdk/mtgsdk)[![License](https://camo.githubusercontent.com/afe7aa37280c522c5021ef5a69e9cff1417b3845bc6eb57ede660be699b4e994/68747470733a2f2f706f7365722e707567782e6f72672f6d746773646b2f6d746773646b2f6c6963656e7365)](https://packagist.org/packages/mtgsdk/mtgsdk)[![composer.lock](https://camo.githubusercontent.com/24268c8263c246711a0bdc5d19ffb31bdde485dd7345147829ae6389c59b3f61/68747470733a2f2f706f7365722e707567782e6f72672f6d746773646b2f6d746773646b2f636f6d706f7365726c6f636b)](https://packagist.org/packages/mtgsdk/mtgsdk)[![Build Status](https://camo.githubusercontent.com/6c71a8bae336ed8100efc6bf7f20038acdb223a7fb1b779c9ba3843bfae6cf93/68747470733a2f2f7472617669732d63692e6f72672f4d61676963546865476174686572696e672f6d74672d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/MagicTheGathering/mtg-sdk-php)[![Code Climate](https://camo.githubusercontent.com/d29e5e4f8eb526cc4da7b16116fdde6d3fea81662b4af3f6b714f9076b7f9ff5/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4d61676963546865476174686572696e672f6d74672d73646b2d7068702f6261646765732f6770612e737667)](https://codeclimate.com/github/MagicTheGathering/mtg-sdk-php)[![Coverage Status](https://camo.githubusercontent.com/4f8ee3cefdf948fa90ded7e1951a7da717c4f051e74ef8bd16b8809ae7d70922/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4d61676963546865476174686572696e672f6d74672d73646b2d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/MagicTheGathering/mtg-sdk-php?branch=master)

This is the Magic: The Gathering SDK PHP implementation. It is a wrapper around the MTG API of [magicthegathering.io](http://magicthegathering.io/).

Requirements
------------

[](#requirements)

This library does not have any requirements.

Installation
------------

[](#installation)

Using composer:

```
composer require mtgsdk/mtgsdk:dev-master

```

Usage
-----

[](#usage)

### Properties Per Class

[](#properties-per-class)

All class properties are camel-cased and documented through class DocBlocks. They respect the API's syntax.

NOTE: **All properties are READ-ONLY. You cannot modify them.**

#### Card

[](#card)

```
name
multiverseid
layout
names
manaCost
cmc
colors
type
supertypes
subtypes
rarity
text
flavor
artist
number
power
toughness
loyalty
variations
watermark
border
timeshifted
hand
life
reserved
releaseDate
starter
rulings
foreignNames
printings
originalText
originalType
legalities
source
imageUrl
set
setName
id

```

#### Set

[](#set)

```
code
name
gathererCode
oldCode
magicCardsInfoCode
releaseDate
border
type
block
onlineOnly
booster
mkmId
mkmName

```

#### Changelog

[](#changelog)

```
version
releaseDate
details

```

### Find Card by Multiverse Id

[](#find-card-by-multiverse-id)

```
$card = Card::find(386616);

```

### Filter Cards via Query Parameters

[](#filter-cards-via-query-parameters)

```
$cards = Card::where(['set' => 'ktk'])->where(['subtypes' => ['warrior', 'human']])->all();

```

### Get all cards (will page through all the data - could take awhile)

[](#get-all-cards-will-page-through-all-the-data---could-take-awhile)

```
$cards = Card::all();

```

### Get all cards, but only a specific page of data

[](#get-all-cards-but-only-a-specific-page-of-data)

```
$cards = Card::where(['page' => 5, 'pageSize' => 30])->all();

```

### Nesting conditions is also allowed

[](#nesting-conditions-is-also-allowed)

```
$cards = Card::where(['page' => 5])->where(['pageSize' => 30])->all();

```

### Find a Set by code

[](#find-a-set-by-code)

```
$set = Set::find('ktk');

```

### Get all sets

[](#get-all-sets)

```
$sets = Set::all();

```

### Filter sets via query parameters

[](#filter-sets-via-query-parameters)

```
$sets = Set::where(['name' => 'khans'])->all();

```

### Get all types

[](#get-all-types)

```
$types = Type::all();

```

### Get all subtypes

[](#get-all-subtypes)

```
$subtypes = Subtype::all();

```

### Get all supertypes

[](#get-all-supertypes)

```
$supertypes = Supertype::all();

```

### Get all changelogs

[](#get-all-changelogs)

```
$changelogs = Changelog::all();

```

Contributing
------------

[](#contributing)

1. Fork it ( [https://github.com/\[my-github-username\]/mtg-sdk-php/fork](https://github.com/%5Bmy-github-username%5D/mtg-sdk-php/fork) )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/34c0365f697eb3491eb619d8cad1f38bc68c7b7140842a7492c6a9d8753a07d5?d=identicon)[guiwoda](/maintainers/guiwoda)

---

Top Contributors

[![guiwoda](https://avatars.githubusercontent.com/u/1625545?v=4)](https://github.com/guiwoda "guiwoda (12 commits)")[![nkaliev](https://avatars.githubusercontent.com/u/22172179?v=4)](https://github.com/nkaliev "nkaliev (4 commits)")[![adback03](https://avatars.githubusercontent.com/u/3609623?v=4)](https://github.com/adback03 "adback03 (1 commits)")[![daggerhart](https://avatars.githubusercontent.com/u/1205329?v=4)](https://github.com/daggerhart "daggerhart (1 commits)")

### Embed Badge

![Health badge](/badges/mtgsdk-mtgsdk/health.svg)

```
[![Health](https://phpackages.com/badges/mtgsdk-mtgsdk/health.svg)](https://phpackages.com/packages/mtgsdk-mtgsdk)
```

###  Alternatives

[ezsystems/ezplatform-matrix-fieldtype

Repository dedicated to Matrix Field Type for eZ Platform

25633.6k11](/packages/ezsystems-ezplatform-matrix-fieldtype)[cobweb/external_import

Tool for importing data from external sources into the TYPO3 database, using an extended TCA syntax. Provides a BE module, a Scheduler task, a command-line tool, reactions and an API.

23369.4k10](/packages/cobweb-external-import)[terminal42/contao-folderpage

Provides a new page type for Contao that allows you to group pages into folders.

18147.9k9](/packages/terminal42-contao-folderpage)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
