Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Handevaluator Bundle Laravel Package

bourdeau/handevaluator-bundle

View on GitHub
Deep Wiki
Context7

Build Status Dependency Status Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License

Poker Hand Evaluator Bundle

About Poker Hand Evaluator Bundle

Hand Evaluator Bundle is a PHP 5.6+ library providing services to evaluate Texas hold'em Poker Hands.

Installation

Prerequisites

A Symfony3 project

With composer

This bundle can be installed using composer by adding the following in the require section of your composer.json file:

    "require": {
        ...
        "bourdeau/handevaluator-bundle": "~0.1"
    },

Register the bundle

You must register the bundle in your kernel:

<?php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new Bourdeau\Bundle\HandEvaluatorBundle\BourdeauBundleHandEvaluatorBundle(),
    ];
    // ...
}

Configuration

There is no configuration for now.

Usage Example

<?php
// Path/To/Your/Controller
$winnerFinder = $this->container->get('bourdeau_bundle_hand_evaluator.winnerfinder');
$players = [
    'John'   => [QH, 2S, QS, JH, 5D, KH, 2H],
    'David'  => [9S, 2D, QS, JH, 5D, KH, 2H],
    'Robert' => [QD, QC, QS, JH, 5D, KH, 2H],
]

$result = $handFinder->findAWinner($players);

// $result will output:
│ array(2) {
│   ["winners"]=>
│   array(1) {
│     ["Robert"]=>
│     array(4) {
│       ["hand_name"]=>
│       string(15) "Three of a kind"
│       ["hand_rank"]=>
│       int(4)
│       ["card_rank"]=>
│       int(11)
│       ["cards"]=>
│       array(3) {
│         [0]=>
│         string(2) "QD"
│         [1]=>
│         string(2) "QC"
│         [2]=>
│         string(2) "QS"
│       }
│     }
│   }
│   ["other_players"]=>
│   array(2) {
│     ["John"]=>
│     array(4) {
│       ["hand_name"]=>
│       string(9) "Two Pairs"
│       ["hand_rank"]=>
│       int(3)
│       ["card_rank"]=>
│       int(11)
│       ["cards"]=>
│       array(4) {
│         [0]=>
│         string(2) "QH"
│         [1]=>
│         string(2) "QS"
│         [2]=>
│         string(2) "2S"
│         [3]=>
│         string(2) "2H"
│       }
│     }
│     ["David"]=>
│     array(4) {
│       ["hand_name"]=>
│       string(8) "One Pair"
│       ["hand_rank"]=>
│       int(2)
│       ["card_rank"]=>
│       int(1)
│       ["cards"]=>
│       array(2) {
│         [0]=>
│         string(2) "2D"
│         [1]=>
│         string(2) "2H"
│       }
│     }
│   }
│ }

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky