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

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

noeldavies/cards
================

A deck of standard cards to build any card game

v0.3(9y ago)1571MITPHPPHP &gt;=5.5.0

Since Feb 2Pushed 9y ago1 watchersCompare

[ Source](https://github.com/NoelDavies/cards)[ Packagist](https://packagist.org/packages/noeldavies/cards)[ RSS](/packages/noeldavies-cards/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

\#Cards. Build a Card game in minutes.

A standard 52-card deck is provided by default, but one can customize to build any deck needed. Create Bridge, BlackJack, Pocker and more...

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

[](#installation)

Pull in the package through Composer.

Run `composer require noeldavies/cards`

Usage
-----

[](#usage)

To start using the deck...

```
$d = new Deck;

$d->shuffle();

//deal... an array of cards
$hand1 = $d->drawHand(10);
$hand2 = $d->drawHand(10);

//draw a single card
$card = deck->draw();

//do something with card
$value = $card->value();
$suit = $card->suit();

//special card?
if($card->isFaceCard()){...}

//cards left in the deck
$deck->count();
```

When the game is over, simply reset the deck by shuffle(ing). The deck now has all the cards (including drawn).

```
//start a new game...
$deck->shuffle();
```

To customise the deck of cards (i.e. which cards are part of the deck) one can implement the CardProvider interface

```
class MyGameDeckProvider implements CardProvider{

    public function getCards(){

        //return an array of card for MyGame
	}
}
//...
$deck = new Deck(new MyGameDeckProvider);
```

You may also want to look at:

- `Shuffleable` for shuffling the cards
- `CardProvider` for providig cards to the deck

**The current implementation doen't let putting cards back into the deck after drawing them. Shuffle resets the deck**

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~159 days

Total

3

Last Release

3477d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/572911?v=4)[Daniel](/maintainers/NoelDavies)[@NoelDavies](https://github.com/NoelDavies)

---

Top Contributors

[![NoelDavies](https://avatars.githubusercontent.com/u/572911?v=4)](https://github.com/NoelDavies "NoelDavies (6 commits)")

---

Tags

Bridgecardsdeck of cards52-cards deckblackjackpocker

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[foxy/foxy

Fast, reliable, and secure NPM/Yarn/pnpm bridge for Composer

177289.8k26](/packages/foxy-foxy)[php-forge/foxy

Fast, reliable, and secure Bun/NPM/Yarn/pnpm bridge for Composer

45126.3k4](/packages/php-forge-foxy)[goaop/goaop-laravel-bridge

Integration bridge for Go! AOP framework

9420.9k](/packages/goaop-goaop-laravel-bridge)[stepanenko3/nova-cards

A Laravel Nova info cards.

33147.6k](/packages/stepanenko3-nova-cards)[zoon/rialto

Manage Node resources from PHP

12233.1k3](/packages/zoon-rialto)

PHPackages © 2026

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