https://github.com/jamessessford/playing-cards
https://github.com/jamessessford/playing-cards
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/jamessessford/playing-cards
- Owner: jamessessford
- Created: 2024-10-30T22:53:02.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-01-26T09:36:50.000Z (5 months ago)
- Last Synced: 2025-03-31T00:51:14.198Z (3 months ago)
- Language: PHP
- Size: 102 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deck of cards
A package to provide an implementation of a deck of cards for fun with [Verbs](verbs.thunk.dev)
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
```php
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
SpadesThe cards that make up each suit are
Ace
Two
Three
Four
Five
Six
Seven
Eight
Nine
Ten
Jack
Queen
KingA 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