PHPackages                             ez-php/support - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ez-php/support

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ez-php/support
==============

General-purpose utility classes for the ez-php ecosystem — Range, WeightedRandom, TimeProbability, DailyQuota

1.11.1(4w ago)021MITPHPPHP ^8.5CI passing

Since Apr 25Pushed 4w agoCompare

[ Source](https://github.com/ez-php/support)[ Packagist](https://packagist.org/packages/ez-php/support)[ Docs](https://github.com/ez-php/support)[ RSS](/packages/ez-php-support/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (6)Versions (8)Used By (0)

ez-php/support
==============

[](#ez-phpsupport)

General-purpose utility classes for the ez-php ecosystem. Zero external dependencies — pure PHP.

Classes
-------

[](#classes)

### Range

[](#range)

Immutable value object for a bounded integer range.

```
$r = Range::of(0, 100);

$r->contains(50);    // true
$r->clamp(150);      // 100
$r->random();        // uniform draw in [0, 100]
$r->weightedLow();   // min-of-two-draws, skewed towards 0
```

### WeightedRandom

[](#weightedrandom)

Stateless weighted random selection from a list of associative arrays.

```
$items = [
    ['name' => 'common', 'weight' => 9],
    ['name' => 'rare',   'weight' => 1],
];

WeightedRandom::pick($items);               // picks one, respecting weights
WeightedRandom::pickN($items, 2);           // picks 2 without replacement
WeightedRandom::weightedLow(0, 100);        // min-of-two-draws
```

Custom weight key:

```
WeightedRandom::pick($items, 'probability');
```

### TimeProbability

[](#timeprobability)

Exponential time-based probability curve: `P(t) = 1 − exp(−t / λ)`.

```
// Deterministic: just the probability value
TimeProbability::probability(minutesSince: 5.0, lambda: 4.0);  // ~0.713

// Stochastic: roll the curve
TimeProbability::exponential(minutesSince: 5.0);  // true/false
```

Always returns `true` once `minutesSince >= hardCapMinutes` (default 15).

### DailyQuota

[](#dailyquota)

Immutable value object for "daily allowance + per-action growing cooldown + UTC midnight reset".

```
$quota = new DailyQuota(dailyLimit: 5, cooldownBaseSeconds: 300, cooldownStepSeconds: 300);
$now   = new DateTimeImmutable();

if ($quota->canPerform($now)) {
    $quota = $quota->perform($now);
    // persist $quota state
}

$quota->remaining();      // actions left today
$quota->cooldownUntil();  // next available time
$quota->usedToday();      // actions performed today
```

UTC midnight resets happen automatically inside `canPerform()` and `perform()`. Call `resetIfNeeded($now)` explicitly to get a fresh instance without performing an action.

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

[](#installation)

```
composer require ez-php/support
```

Testing
-------

[](#testing)

```
composer full
```

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance94

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community6

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 ~3 days

Total

7

Last Release

29d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/122030400?v=4)[AU9500](/maintainers/AU9500)[@AU9500](https://github.com/AU9500)

---

Top Contributors

[![AU9500](https://avatars.githubusercontent.com/u/122030400?v=4)](https://github.com/AU9500 "AU9500 (11 commits)")

---

Tags

phputilitiessupportrangeweighted randomez-phptime-probabilitydaily-quota

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ez-php-support/health.svg)

```
[![Health](https://phpackages.com/badges/ez-php-support/health.svg)](https://phpackages.com/packages/ez-php-support)
```

PHPackages © 2026

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