PHPackages                             gamebetr/cards - 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. gamebetr/cards

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

gamebetr/cards
==============

Extends probable library for card games

1.0.4(6y ago)13521PHPPHP &gt;=7.2CI failing

Since Dec 16Pushed 3y ago2 watchersCompare

[ Source](https://github.com/dbd-net/cards)[ Packagist](https://packagist.org/packages/gamebetr/cards)[ RSS](/packages/gamebetr-cards/feed)WikiDiscussions develop Synced 4d ago

READMEChangelog (1)Dependencies (2)Versions (6)Used By (0)

Cards
=====

[](#cards)

The cards package extends the gamebetr/provable package to provide a provably fair way to shuffle and utilize decks of cards.

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

[](#installation)

```
composer require gamebetr/cards ^1.0

```

Gamebetr\\Cards\\Deck Object
----------------------------

[](#gamebetrcardsdeck-object)

### Initialization

[](#initialization)

```
$deck = new Gamebetr\Cards\Deck();

```

or

```
$deck = Gamebetr\Cards\Deck::init();

```

### Deck Methods

[](#deck-methods)

#### \_\_construct(string $clientSeed = null, string $serverSeed = null, int $deckCount = 1, bool $jokers = false)

[](#__constructstring-clientseed--null-string-serverseed--null-int-deckcount--1-bool-jokers--false)

**$clientSeed** - This is the client seed used to generate the provably fair shuffle. The default value of null will cause the Provable class to auto generate a client seed.

**$serverSeed** - This is the server seed used to generate the provably fair shuffle. The default value of null will cause the Provable class to auto generate a server seed.

**$deckCount** - This is the amount of card decks to use. The default is 1.

**$jokers** - This parameter determines whether jokers will be included in the deck. The default is false.

#### init(string $clientSeed = null, string $serverSeed = null, int $deckCount = 1, bool $jokers = false) : Gamebetr\\Cards\\Deck

[](#initstring-clientseed--null-string-serverseed--null-int-deckcount--1-bool-jokers--false--gamebetrcardsdeck)

This method is just a static constructor to make it cleaner when instanciating the Deck class. This will return a Deck class.

#### getProvable() : Gamebetr\\Provable\\Provable

[](#getprovable--gamebetrprovableprovable)

This method will return the Gamebetr\\Provable\\Provable instance used to shuffle the deck.

#### deal() : Gamebetr\\Cards\\Card

[](#deal--gamebetrcardscard)

This method will return the top Gamebetr\\Cards\\Card in the deck.

#### burn()

[](#burn)

This method will burn the top card in the deck.

#### getCards() : array

[](#getcards--array)

This method will return the full, original shuffled values of the deck. The values in this array are the numeric values used to create the Gamebetr\\Cards\\Card objects.

#### getRemainingCards() : array

[](#getremainingcards--array)

This method will return an array of all remaining Gamebetr\\Cards\\Card in the deck.

#### getDealtCards() : array

[](#getdealtcards--array)

This method will return an array of all of the dealt Gamebetr\\Cards\\Card in the deck.

#### getBurntCards() : array

[](#getburntcards--array)

This method will return an array of all of the burnt Gamebetr\\Cards\\Card in the deck.

### Card Methods

[](#card-methods)

#### \_\_construct(int $value)

[](#__constructint-value)

**$value** - This is the value of the card.

#### init(int $value) : Card

[](#initint-value--card)

This method is just a static constructor for the Card object. This will return a Card class.

#### isJoker() : bool

[](#isjoker--bool)

This method will return true of the Card is a joker.

#### suit() : int

[](#suit--int)

This method will return an integer representation of the card suit. 0 = clubs, 1 = diamonds, 2 = hearts, 3 = spades.

#### suitName() : string

[](#suitname--string)

This method will return the name of the card suit.

#### rank() : int

[](#rank--int)

This method will return an integer representation of the card rank. -1 = joker, 0 = 2, 1 = 3, 2 = 4, 3 = 5, 4 = 6, 5 = 7, 6 = 8, 7 = 9, 8 = 10, 9 = jack, 10 = queen, 11 = king, 12 = ace.

#### rankName() : string

[](#rankname--string)

This method will return the name of the card rank.

#### value() : int

[](#value--int)

This method will return the integer value for the card. joker = 0, 2-9 = the face value, 10-king = 10, ace = 11.

#### name() : string

[](#name--string)

This method is an alias of rankName().

#### fullName() : string

[](#fullname--string)

This method returns the full name of the card (e.g. two of diamonds).

#### greaterThan(Gamebetr\\Cards\\Card $card, bool $useSuitValue = false)

[](#greaterthangamebetrcardscard-card-bool-usesuitvalue--false)

This method will compare the card against a different card and return true if the current card is of greater value. By specifying true for the $useSuitValue, it will rank two matching cards by suit.

#### lessThan(Gamebetr\\Cards\\Card $card, bool $useSuitValue = false)

[](#lessthangamebetrcardscard-card-bool-usesuitvalue--false)

This method will compare the card against a different card and return true if the current card is of lesser value. By specifying true for the $useSuitValue, it will rank two matching cards by suit.

#### equalTo(Gamebetr\\Cards\\Card $card, bool $useSuitValue = false)

[](#equaltogamebetrcardscard-card-bool-usesuitvalue--false)

This method will compare the card against a different card and return true if the current card is of the same value. By specifying true for the $useSuitValue, it will rank two matching cards by suit.

#### compare(Gamebetr\\Cards\\Card $card, bool $useSuitValue = false)

[](#comparegamebetrcardscard-card-bool-usesuitvalue--false)

This method will compare the card against a different card and return -1 if the card is of lesser value, 0 if the cards have the same value, and 1 if the card is of greater value. By specifying true for the $useSuitValue, it will rank two matching cards by suit.

#### \_\_toString()

[](#__tostring)

This method is an alias of getName().

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 58.3% 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.

###  Release Activity

Cadence

Every ~45 days

Total

4

Last Release

2207d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf27c173a13d30c1905fc93b2f1b5215cf89f538cd0f3072c882a2af79234de0?d=identicon)[gamebetr](/maintainers/gamebetr)

---

Top Contributors

[![swichers](https://avatars.githubusercontent.com/u/5890607?v=4)](https://github.com/swichers "swichers (7 commits)")[![submtd](https://avatars.githubusercontent.com/u/2303288?v=4)](https://github.com/submtd "submtd (3 commits)")[![gamebetr](https://avatars.githubusercontent.com/u/55413277?v=4)](https://github.com/gamebetr "gamebetr (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[wordpress/skeleton

Composer based WordPress project skeleton.

461.7k](/packages/wordpress-skeleton)

PHPackages © 2026

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