PHPackages                             jamesbrooks/php-clamp - 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. jamesbrooks/php-clamp

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

jamesbrooks/php-clamp
=====================

Clamp one number between a min and max.

v0.1.0(5y ago)132.1k↓54.2%2MITPHP

Since Aug 21Pushed 5y ago2 watchersCompare

[ Source](https://github.com/jbrooksuk/php-clamp)[ Packagist](https://packagist.org/packages/jamesbrooks/php-clamp)[ GitHub Sponsors](https://github.com/jbrooksuk)[ RSS](/packages/jamesbrooks-php-clamp/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

PHP Clamp
=========

[](#php-clamp)

Clamp one number between a min and max.

Usage
-----

[](#usage)

```
// $number = clamp($value, $min, $max);

clamp(10, 1, 100); // => 10
clamp(10, 1, 5); // 5
clamp(-10, 1, 5); // 1
```

License
-------

[](#license)

PHP Clamp is licensed under [The MIT License (MIT)](/LICENSE).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% 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

Unknown

Total

1

Last Release

2143d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e4934b15ff7d8cffabece955994bed29b31429f4c2e8f13fa0868c753bb1c30?d=identicon)[jbrooksuk](/maintainers/jbrooksuk)

---

Top Contributors

[![jbrooksuk](https://avatars.githubusercontent.com/u/246103?v=4)](https://github.com/jbrooksuk "jbrooksuk (10 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (5 commits)")[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (1 commits)")

---

Tags

php

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/jamesbrooks-php-clamp/health.svg)

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

###  Alternatives

[spatie/emoji

Display emoji characters

4751.3M40](/packages/spatie-emoji)[imanghafoori/php-imports-analyzer

A command line tool to scan for extra or wrong use statements in composer based apps.

21233.2k25](/packages/imanghafoori-php-imports-analyzer)[version/version

A library for creating, editing, and comparing semantic versioning numbers.

10673.8k6](/packages/version-version)[stape/gtm-server-side-magento-module

Stape Conversion Tracking Magento Module

1368.1k](/packages/stape-gtm-server-side-magento-module)

PHPackages © 2026

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