jamessessford/playing-cards

A PHP implementation of a deck of playing cards to be used with Verbs

v1.0.2 2025-01-26 09:35 UTC

This package is auto-updated.

Last update: 2025-02-26 09:53:12 UTC


README

A package to provide an implementation of a deck of cards for fun with Verbs

To use this package, run composer require jamessessford/playing-cards.

Once installed, you can run php artisan vendor:publish --provider=PlayingCards\\PlayingCardsProvider to publish the card images to your public directory.

Usage

use PlayingCards\Deck;
use PlayingCards\CardCollection;

$deck = new Deck();

$cardCollection = CardCollection::make($deck->deal());

$cardImage = card_front($cardCollection->pop());
$cardBackImage = card_back();

Deck contents

4 suits of 13 cards.

The suits in the deck are

Hearts
Clubs
Diamonds
Spades

The cards that make up each suit are

Ace
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
Jack
Queen
King

A deck consists of 52 cards, covering each value for each suit

A deck can be shuffled

A deck can be dealt from

A deck can be queried for remaining cards

Cards

A card has a suit and a value