{"id":19297592,"url":"https://github.com/limen/redenvelope","last_synced_at":"2026-03-03T12:35:32.236Z","repository":{"id":57015086,"uuid":"83660621","full_name":"limen/redenvelope","owner":"limen","description":"Php library for red envelope/packet (红包) what is popular among Chinese.","archived":false,"fork":false,"pushed_at":"2018-10-17T07:15:24.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-24T01:47:09.567Z","etag":null,"topics":["assignment","random","redenvelope","redpacket","variance"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/limen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-02T09:36:55.000Z","updated_at":"2023-03-17T06:07:25.000Z","dependencies_parsed_at":"2022-08-22T09:30:24.890Z","dependency_job_id":null,"html_url":"https://github.com/limen/redenvelope","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/limen/redenvelope","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limen%2Fredenvelope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limen%2Fredenvelope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limen%2Fredenvelope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limen%2Fredenvelope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/limen","download_url":"https://codeload.github.com/limen/redenvelope/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/limen%2Fredenvelope/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263984747,"owners_count":23539762,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assignment","random","redenvelope","redpacket","variance"],"created_at":"2024-11-09T23:05:25.856Z","updated_at":"2026-03-03T12:35:27.190Z","avatar_url":"https://github.com/limen.png","language":"PHP","readme":"# PHP library for red envelope (红包) what is popular among Chinese.\n\n[![Build Status](https://travis-ci.org/limen/redenvelope.svg?branch=master)](https://travis-ci.org/limen/redenvelope)\n[![Packagist](https://img.shields.io/packagist/l/limen/redenvelope.svg?maxAge=2592000)](https://packagist.org/packages/limen/redenvelope)\n\n## Features\n\n+ Amount is assigned randomly.\n+ Minimum value of each assignment is settable.\n+ Amount precision is settable.\n+ Variance factor is settable which would influence the variance of the assignment sequence.\n\n## Installation\n\nRecommend to install via [composer](https://getcomposer.org/ \"\").\n\n```bash\ncomposer require \"limen/redenvelope\"\n```\n\n## Usage\n\n```php\nuse Limen\\RedEnvelope\\Envelope;\n\n$id = '123';                    // unique id\n$remain = 212.23;               // envelope remain amount\n$dividend = 10;                 // how many fragments to divide amount into\n$minAssignment = 10.1;          // minimum value of each assignment\n$precision = 2;                 // assignment precision\n\n$varianceFactor = 1.0;          // Appropriate value should between 0.5 and 1.5, 1.0 may be the best.\n                                // The greater this value, the greater the variance of the divided sequence is.\n\n$envelope = new Envelope($id);\n\n$envelope-\u003esetRemain($remain)\n    -\u003esetDividend($dividend);\n    -\u003esetPrecision($precision)\n    -\u003esetMinAssignment($minAssignment)\n    -\u003esetVarianceFactor($varianceFactor);\n\n$assignment = $envelope-\u003eopen();\n```\n\n## Development\n\n### Test\n\n```bash\n$ phpunit --bootstrap tests/bootstrap.php tests/\nPHPUnit 5.7.15 by Sebastian Bergmann and contributors.\n\n..\nTotal amount: 214.4\nDividend: 20\nMinimum Assignment: 0.86\nVariance factor: 0.7\nPrecision: 2\nAssignment value: 10.72\n..\nTotal amount: 64\nDividend: 4\nMinimum Assignment: 7\nVariance factor: 1.5\nPrecision: 0\nAssignments: \nNo.0: 19.000000\nNo.1: 15.000000\nNo.2: 7.000000\nNo.3: 23.000000\n.                                                               5 / 5 (100%)\n\nTime: 165 ms, Memory: 13.25MB\n\nOK (5 tests, 36 assertions)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimen%2Fredenvelope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flimen%2Fredenvelope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flimen%2Fredenvelope/lists"}