A PHP library based on SwitchbladeBot/runeterra developed for
decoding deckcodes and encoding decks for Legends of Runeterra.
composer require mike-reinders/runeterra-php
Visit Packagist.org mike-reinders/runeterra-php
Download Composer PHP Dependency Manager
// DeckEncoding
$raw_deck = DeckEncoding::decode("CEBAIAICAMGRWMIHAECQOCQVC4RC6MICAEAQKKQBAEBASAQBAECQ6AQBAIDSA");
$deck_code = DeckEncoding::encode($raw_deck);
// or DeckEncodingFactory
$raw_deck = DeckEncodingFactory::toRawDeck("CEBAIAICAMGRWMIHAECQOCQVC4RC6MICAEAQKKQBAEBASAQBAECQ6AQBAIDSA");
$deck_code = DeckEncodingFactory::fromRawDeck($raw_deck);
$raw_deck = [
[
0 => 1, // set
1 => 2, // faction id
2 => 3, // card number
3 => 3 // card count
],
...
];
// DeckEncodingFactory
$card_code_deck = DeckEncodingFactory::toCardCodeDeck("CEBAIAICAMGRWMIHAECQOCQVC4RC6MICAEAQKKQBAEBASAQBAECQ6AQBAIDSA");
$deck_code = DeckEncodingFactory::fromCardCodeDeck($card_code_deck);
$card_code_deck = [
"01IO003" => 3, // card code => count
"01IO013" => 3,
"01SI049" => 3,
"01SI042" => 2,
"01IO009" => 2,
"01SI015" => 1,
...
];
// DeckEncodingFactory
$card_deck = DeckEncodingFactory::toCardDeck("CEBAIAICAMGRWMIHAECQOCQVC4RC6MICAEAQKKQBAEBASAQBAECQ6AQBAIDSA", Card::class);
$deck_code = DeckEncodingFactory::fromCardDeck($card_deck);
$card_deck = [
Card {
#set: 1
#faction_id: 2
#number: 3
#count: 3
},
Card {
#set: 1
#faction_id: 2
#number: 13
#count: 3
},
Card {
#set: 1
#faction_id: 2
#number: 27
#count: 3
},
Card {
#set: 1
#faction_id: 2
#number: 49
#count: 3
}
...
];
composer install --dev
./vendor/bin/phpunit --bootstrap vendor/autoload.php --testdox tests
- Docker Desktop CE for Windows or Mac
- Docker Engine CE for Ubuntu, Debian or install manually
docker build --no-cache -t runeterra-php:latest ./docker
# simply run
docker run --name=runeterra-php --rm -it runeterra-php test
# watch: Linux Shell
docker run --name=runeterra-php --rm --volume "/${PWD}:/repository:rw" -it runeterra-php test watch
# watch: Windows Powershell
docker run --name=runeterra-php --rm --volume "${PWD}:/repository:rw" -it runeterra-php test watch
# watch: Windows Command Prompt (CMD)
docker run --name=runeterra-php --rm --volume "%CD%:/repository:rw" -it runeterra-php test watch