PHPackages                             victtech/lottery - 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. victtech/lottery

ActiveLibrary

victtech/lottery
================

1.0.8(3y ago)015MITPHPPHP ^7.0|^8.0

Since Nov 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/vt-ryan1/lottery)[ Packagist](https://packagist.org/packages/victtech/lottery)[ Docs](https://github.com/victtech/lottery)[ RSS](/packages/victtech-lottery/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (9)Used By (0)

Lottery 抽奖功能
============

[](#lottery-抽奖功能)

\[!\[Latest Version on Packagist\]\[ico-version\]\]\[link-packagist\] \[!\[Total Downloads\]\[ico-downloads\]\]\[link-downloads\] \[!\[Build Status\]\[ico-travis\]\]\[link-travis\] \[!\[StyleCI\]\[ico-styleci\]\]\[link-styleci\]

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

[](#installation)

Via Composer

```
$ composer require victtech/lottery
```

Usage
-----

[](#usage)

#### 安装完之后，发布配置文件

[](#安装完之后发布配置文件)

```
    php artisan vendor:publish --tag=lottery.config
```

#### 中奖概率配置文件说明

[](#中奖概率配置文件说明)

```
    //配置中奖的概率以及每个奖项的数目
    return [
    'awards'=>[
        //key 是奖项名称
        '一等奖'=>[
            'total'=>5, //奖项总数量
            'probability'=>30  //中奖概率，百分率.所有奖项百分率之外就是不中奖概率
        ],
        '二等奖'=>[
            'total'=>10,
            'probability'=>50
        ]
    ],
];
```

#### 1.抽奖使用方法(人固定，奖项随机)

[](#1抽奖使用方法人固定奖项随机)

```
Lottery::getAward();

```

返回中的奖项名称，也就是配置中的key值

#### 2.抽奖使用方法(奖项固定，人随机)

[](#2抽奖使用方法奖项固定人随机)

```
PersonLottery::getAward($dataSource,$count);
$dataSource //数据源所有参与抽奖的人员，数组格式，
$count //中奖人数

```

返回长度是$count的包含抽奖人员的数组，代表中奖人员

#### 清除已中奖信息

[](#清除已中奖信息)

```
    php artisan lottery:clearRecord //清除抽奖的奖项剩余信息
    php artisan lottery:clearPersonRecord //清除已经中奖的人员信息
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Every ~14 days

Recently: every ~24 days

Total

8

Last Release

1187d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cda8f9c806beae76e893940114a437ba0df2eb52574af45e2ec479142da0fe27?d=identicon)[vt-ryan1](/maintainers/vt-ryan1)

---

Top Contributors

[![vt-ryan1](https://avatars.githubusercontent.com/u/27496656?v=4)](https://github.com/vt-ryan1 "vt-ryan1 (7 commits)")

---

Tags

laravellottery

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/victtech-lottery/health.svg)

```
[![Health](https://phpackages.com/badges/victtech-lottery/health.svg)](https://phpackages.com/packages/victtech-lottery)
```

###  Alternatives

[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

394388.0k5](/packages/rtconner-laravel-likeable)[hemp/presenter

Easy Model Presenters in Laravel

247592.6k1](/packages/hemp-presenter)[slowlyo/owl-admin

基于 laravel、amis 开发的后台框架~

61214.2k26](/packages/slowlyo-owl-admin)

PHPackages © 2026

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