PHPackages                             simple-hacker/phpoker - 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. simple-hacker/phpoker

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

simple-hacker/phpoker
=====================

PHP library package for No Limit Texas Holdem poker

0.1.0(5y ago)217MITPHP

Since Nov 26Pushed 5y agoCompare

[ Source](https://github.com/simple-hacker/PHPoker)[ Packagist](https://packagist.org/packages/simple-hacker/phpoker)[ RSS](/packages/simple-hacker-phpoker/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHPoker
=======

[](#phpoker)

PHP library package for No Limit Texas Holdem poker. This package allows you to find the best Texas Holdem hand out of the given Cards.

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

[](#installation)

Require the package using composer

```
composer require simple-hacker/phpoker
```

Usage
-----

[](#usage)

```
use simplehacker\PHPoker\Hands\TexasHoldemHand;

$communityCards = '3hJdQdAdKd';
$holeCards = 'Td6s';

$hand = new TexasHoldemHand($communityCards, $holeCards);
```

The Cards as a string of short values, or an array of short values and/or Card instances.

The following results at the same:

```
$communityCards = '3hJdQdAdKd';
$communityCards = ['3h', 'Jd', 'Qd', 'Ad', 'Kd'];
$communityCards = [new Card('3h'), new Card('Jd'), new Card('Qd'), new Card('Ad'), new Card('Kd')];
$communityCards = [new Card('3h'), 'Jd', new Card('Qd'), 'Ad', new Card('Kd')];  // A mix of both
```

Once a hand has been instantiated, you are able to get the hand description as well as a numerical value of the hand used for comparing against other hands.

```
use simplehacker\PHPoker\Hands\TexasHoldemHand;

$communityCards = '3hJdQdAdKd';
$holeCards = 'Td6s';

$hand = new TexasHoldemHand($communityCards, $holeCards);

// Royal Flush, Ace to Ten of Diamonds
$hand->getDescription();

// AdKdQdJdTd
$hand->getShortDescription();

// 10
$hand->getHandRank();

// const ROYAL_FLUSH_RANK      = 10;
// const STRAIGHT_FLUSH_RANK   = 9;
// const FOUR_OF_A_KIND_RANK   = 8;
// const FULL_HOUSE_RANK       = 7;
// const FLUSH_RANK            = 6;
// const STRAIGHT_RANK         = 5;
// const THREE_OF_A_KIND_RANK  = 4;
// const TWO_PAIR_RANK         = 3;
// const ONE_PAIR_RANK         = 2;
// const HIGH_CARD_RANK        = 1;

// 11459770
$hand->getHandValue();

// Hand value is generated from converting Hand Rank and all Card values to a binary string, and converting back to base 10.  This ensures the best hand will always be the highest number
```

Cards
-----

[](#cards)

Cards can be instantiated in numerous ways. The following all result in the Ace of Spades:

```
// As a short value where the first character is card value 23456789TJQKA,
// and the second character is card suit as shcd
new Card('As');

// Arguments for both value and suit
new Card('Ace', 'Spades');
new Card('A', 's');

// As numerical values
// Jack = 11, Queen = 12, King = 13, Ace = 1 or 14
// Clubs = 1, Diamonds = 2, Hearts = 3, Spades = 4
new Card(14, 4);

// Or any combination of the above
new Card('Ace', 's');
new Card(1, 'spades');
```

A InvalidCardException will be thrown for invalid values or suits

Upcoming releases
-----------------

[](#upcoming-releases)

- Compare TexasHoldemHands to determine winner
- Other poker variants such as Omaha, Short Deck, Razz, Stud etc

Disclaimer
----------

[](#disclaimer)

I am not responsible for any money won or loss as a result of any mistakes made in this package. This was created as a learning exercise so use this package at your own risk.

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](./LICENSE.md)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

1999d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd002b2558b2ab34b2ae368f446c381f0af3d5ebaedecc26ae871ab50eb11d6e?d=identicon)[simplehacker](/maintainers/simplehacker)

---

Top Contributors

[![simple-hacker](https://avatars.githubusercontent.com/u/25870094?v=4)](https://github.com/simple-hacker "simple-hacker (65 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/simple-hacker-phpoker/health.svg)

```
[![Health](https://phpackages.com/badges/simple-hacker-phpoker/health.svg)](https://phpackages.com/packages/simple-hacker-phpoker)
```

###  Alternatives

[lbaey/chromedriver

Utility for installing Chromedriver, whatever platform you are on, for use with Behat

1459.5k1](/packages/lbaey-chromedriver)

PHPackages © 2026

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