PHPackages                             rickselby/consthelpers - 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. rickselby/consthelpers

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

rickselby/consthelpers
======================

1.2(10y ago)023MITPHPPHP &gt;=5.4.0

Since Oct 17Pushed 10y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/33b5193d5e827a01e3649707e30a01ec20256cd6ba9580670921e78254928a3b/68747470733a2f2f7472617669732d63692e6f72672f7269636b73656c62792f636f6e737468656c706572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rickselby/consthelpers)[![Coverage Status](https://camo.githubusercontent.com/f42f11acd315ff23a68d2b15f145151b179d3faa377949b9f70290ae22dc7d70/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7269636b73656c62792f636f6e737468656c706572732f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/rickselby/consthelpers?branch=master)

Helper traits to use when using a class with many constants.

Also a place for me to test CI stuff.

Example
-------

[](#example)

```
class DataRef
{
    use \ConstHelpers\Validating;

    const POINT_NORTH = 0;
    const POINT_SOUTH = 1;
    const POINT_EAST = 2;
    const POINT_WEST = 3;
    const POINT_UP = 4;
    const POINT_DOWN = 5;

    const ORIENT_NORMAL = 6;
    const ORIENT_INVERSE = 7;
}

// Get the list of constants that start with 'POINT_'
$consts = DataRef::startsWith('POINT_'));

// Validate a value against the constants starting with 'POINT_'
if (DataRef::isValidStartsWith($value, 'POINT_')) {
...

// Validate against constants matching a regular expression
if (DataRef::isValid($value, '/T.*E/')) {
...
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

3801d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cc8910980f053d8ceb2e9d938427cf03ae509884763a10f916b4eef5591934f?d=identicon)[rickselby](/maintainers/rickselby)

---

Top Contributors

[![rickselby](https://avatars.githubusercontent.com/u/1564517?v=4)](https://github.com/rickselby "rickselby (20 commits)")

---

Tags

constants

### Embed Badge

![Health badge](/badges/rickselby-consthelpers/health.svg)

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

###  Alternatives

[rexlabs/enum

Enumeration (enum) implementation for PHP

48482.2k2](/packages/rexlabs-enum)[php-stubs/wordpress-globals

Global variables and global constants from WordPress core.

13799.0k17](/packages/php-stubs-wordpress-globals)

PHPackages © 2026

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