2017 © Pedro Peláez
 

library cards

A deck of standard cards to build any card game

image

fust/cards

A deck of standard cards to build any card game

  • Saturday, December 24, 2016
  • by Aner-Git
  • Repository
  • 1 Watchers
  • 0 Stars
  • 26 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

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..., (*1)

Installation

Pull in the package through Composer., (*2)

Run composer require fust/cards, (*3)

Usage

To start using the deck..., (*4)


$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)., (*5)

//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, (*6)

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:, (*7)

  • 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, (*8)

The Versions

24/12 2016

dev-master

9999999-dev

A deck of standard cards to build any card game

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Aner

cards bridge deck of cards 52-cards deck blackjack pocker

24/12 2016

v0.1.1

0.1.1.0

A deck of standard cards to build any card game

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Aner

cards bridge deck of cards 52-cards deck blackjack pocker

02/02 2016

v0.1

0.1.0.0

A deck of standard cards to build any card game

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

by Aner

cards bridge deck of cards 52-cards deck blackjack pocker