承接 limen/redenvelope 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

limen/redenvelope

Composer 安装命令:

composer require limen/redenvelope

包简介

PHP library for red envelopes which are popular among Chinese

README 文档

README

Build Status Packagist

Features

  • Amount is assigned randomly.
  • Minimum value of each assignment is settable.
  • Amount precision is settable.
  • Variance factor is settable which would influence the variance of the assignment sequence.

Installation

Recommend to install via composer.

composer require "limen/redenvelope"

Usage

use Limen\RedEnvelope\Envelope;

$id = '123';                    // unique id
$remain = 212.23;               // envelope remain amount
$dividend = 10;                 // how many fragments to divide amount into
$minAssignment = 10.1;          // minimum value of each assignment
$precision = 2;                 // assignment precision

$varianceFactor = 1.0;          // Appropriate value should between 0.5 and 1.5, 1.0 may be the best.
                                // The greater this value, the greater the variance of the divided sequence is.

$envelope = new Envelope($id);

$envelope->setRemain($remain)
    ->setDividend($dividend);
    ->setPrecision($precision)
    ->setMinAssignment($minAssignment)
    ->setVarianceFactor($varianceFactor);

$assignment = $envelope->open();

Development

Test

$ phpunit --bootstrap tests/bootstrap.php tests/
PHPUnit 5.7.15 by Sebastian Bergmann and contributors.

..
Total amount: 214.4
Dividend: 20
Minimum Assignment: 0.86
Variance factor: 0.7
Precision: 2
Assignment value: 10.72
..
Total amount: 64
Dividend: 4
Minimum Assignment: 7
Variance factor: 1.5
Precision: 0
Assignments: 
No.0: 19.000000
No.1: 15.000000
No.2: 7.000000
No.3: 23.000000
.                                                               5 / 5 (100%)

Time: 165 ms, Memory: 13.25MB

OK (5 tests, 36 assertions)

统计信息

  • 总下载量: 64
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固