Download the PHP package infocyph/game-draw without Composer

On this page you can find all versions of the php package infocyph/game-draw. 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 game-draw

Game Draw

Codacy Badge Libraries.io dependency status for GitHub repo Packagist Downloads License: MIT Packagist Version Packagist PHP Version Support GitHub code size in bytes

The Game Draw library provides flexible and varied methods for selecting winners based on different types of draws, Lucky Draw, Grand Draw, and a customizable Flexible Draw to meet a range of requirements.

Please don't use this to generate things/prizes with People's hard-earned money. It is intended to make things fun with bonus gifts only.

Prerequisites

Installation

Overview

1. LuckyDraw

The LuckyDraw class allows for winner selection based on item chances and weighted amounts.

Input Data

Usage

Example Output:

Inventory Solutions: Available stock should be passed (after subtracting used amount from stock amount) in chances properly.

2. GrandDraw

The GrandDraw class is designed for large draws where items and user entries are managed in bulk.

Input Data

User entries are loaded using a CSV file:

Usage

Example Output:

3. FlexibleDraw

The FlexibleDraw class provides a versatile approach to selection, offering various types of draw methods, including probability-based, elimination, round-robin, time-based, and more. This flexibility allows for customized and dynamic draws, suitable for a range of applications.

Supported Draw Types

FlexibleDraw Options and Usage Examples

Below are usage examples for each draw type. Define your items array based on the draw type requirements.

  1. Probability Draw:

    • Selects items based on weighted probabilities. Higher-weight items have a greater likelihood of selection.
  2. Elimination Draw:

    • Items are drawn once, removed from the pool after selection.
  3. Weighted Elimination Draw:

    • Similar to elimination, but uses weights to influence item selection.
  4. Round Robin Draw:

    • Cycles through items in a round-robin sequence.
  5. Cumulative Draw:

    • Draws items based on cumulative scores, with selection probabilities adjusted over time.
  6. Batched Draw:

    • Draws a batch of items in one call, with optional replacement.
  7. Time-Based Weighted Draw:

    • Selects items based on weight and a specified time interval (e.g., daily or weekly).
  8. Weighted Batch Draw:

    • Draws a batch of items using weighted probabilities, balancing selections by item weight.
  9. Sequential Draw:

    • Selects items in a predefined sequence.
  10. Range Weighted Draw:
    • Specifies a range for each item using min, max, and weight.

Usage

To use the FlexibleDraw class, create an instance with your items array and specify the draw type in the draw method:

Example Output

The output depends on the draw type and item configuration. For example, a probability draw with weights might yield:

FlexibleDraw Configuration Summary

The FlexibleDraw class is highly adaptable, supporting various selection methods and configurations such as weight, group, min, max, and time. Ideal for applications needing nuanced and dynamic draws, it is more versatile than simpler draw mechanisms but optimized for manageable volumes.

Support

Having trouble? Create an issue!


All versions of game-draw with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-bcmath Version *
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 infocyph/game-draw contains the following files

Loading the files please wait ....