Download the PHP package likewinter/card-deck without Composer

On this page you can find all versions of the php package likewinter/card-deck. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package card-deck

Card Deck

CI Coverage PHPStan

A PHP 8.5+ engine for building card games — the primitives, not the UI.

likewinter/card-deck provides game-agnostic building blocks for playing card games: cards, decks, stacks, a table, rank/suit ordering, trick-taking primitives, deck builders, wildcards, and face-down state. You bring the rules; the framework brings the table.

Five reference games prove the primitives fit real, non-trivial games: Poker (hand ranking and tiebreakers), Blackjack (additive scoring with soft/hard aces), Spades (trick-taking with trump), Solitaire (face-down tableau management), and JokerPoker (wildcard substitution with jokers).

Requirements

Install

Quick start

What's included

Primitive Purpose
Suit Identity of a playing card
PlayableCard Interface for anything a Stack can hold (Card, CardInPlay, Wildcard)
Stack Ordered collection of playable cards with capacity
DeckBuilder Fluent factory for standard and custom decks
Table Orchestrates dealing, discarding, and resetting across named hands
DrawMode How Table draws from the deck (Sequential, OneByOne, Random)
RankOrder Game-specific rank values and comparison
SuitOrder Trick-taking: trump and lead-suit rules
Trick One round of play with turn order and winner determination
PlayerRing Rotating turn order (standalone, also used internally by Trick)
Face Face-up / face-down state
Wildcard Wildcard substitution without mutating cards

Documentation

Game fit

The framework supports most popular card games. ✅ = directly possible with the current primitives.

Game Fit Notes
5-Card Stud Poker ✅ Reference implementation in src/Games/Poker/
Texas Hold'em / Omaha ✅ Table::drawAll(2) for holes + Stack::takeTop() for community cards; best-5-from-7 evaluator is game logic
Blackjack ✅ RankOrder::blackjack() + multi-deck via DeckBuilder::times(6)
Bridge / Spades / Hearts ✅ SuitOrder + Trick + PlayerRing
Rummy / Gin Rummy ✅ Stack::takeTop() to draw discards, Table::discard() to discard, Stack for melds
War ✅ CardInPlay + Face::Down for the face-down war cards
Crazy Eights ✅ Wildcard for wild 8s
Euchre ✅ DeckBuilder::euchre() + trump primitives
Canasta ✅ Wildcard + DeckBuilder::standard52WithJokers(4)->times(2)
Solitaire (Klondike) ✅ CardInPlay + Face::Down for the tableau
Pinochle ✅ DeckBuilder::pinochle() + custom RankOrder
Skat ✅ Custom RankOrder (Jacks above Ace) + SuitOrder
Belote ✅ Custom RankOrder (J=20, 9=14, A=11, …) + SuitOrder

Design principles

  1. Game-agnostic core. Card, Stack, Table know nothing about poker, bridge, or blackjack. Game-specific ordering lives in RankOrder and SuitOrder, supplied by the game.
  2. Immutable where it matters. Card, Rank, Suit, RankOrder, SuitOrder, CardInPlay, and Wildcard are immutable. Mutable state (card collections) lives in Stack and its subclasses.
  3. Composable, not prescriptive. The framework gives you primitives; you assemble them into a game. There is no Game base class to extend.
  4. No UI, no I/O, no persistence. Pure domain logic. Rendering, networking, and storage are the consumer's responsibility.
  5. Honest about limits. Capacity is enforced. Failed moves roll back. Cards can't be lost to a thrown exception.

Reference games

Five reference implementations prove the primitives fit real games:

Run the demos:

Testing

Tests cover every primitive and all five reference games:

Changelog

See CHANGELOG.md for notable changes between releases.

License

MIT — see LICENSE.


All versions of card-deck with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package likewinter/card-deck contains the following files

Loading the files please wait ...