PHPackages                             gavinggordon/constantgroups - 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. gavinggordon/constantgroups

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

gavinggordon/constantgroups
===========================

A PHP class which provides quick as-needed access to pre- and user defined data via constants.

1.0.0(9y ago)018MITPHP

Since Feb 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/gavinggordon/constantgroups)[ Packagist](https://packagist.org/packages/gavinggordon/constantgroups)[ Docs](http://constantgroups.gavingordon.com)[ RSS](/packages/gavinggordon-constantgroups/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

ConstantGroups
==============

[](#constantgroups)

[![Packagist Version](https://camo.githubusercontent.com/dc9f6084108d17d1ca50e131a7ae11978e39b3dd7403ef0981f5fa8343691f43/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676176696e67676f72646f6e2f636f6e7374616e7467726f7570732e737667)](https://packagist.com/gavinggordon/constantgroups)[![Github Release](https://camo.githubusercontent.com/d4c77fcf872ba42c589b87812e06760b93d396d911fa103d78752febb993dbc9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f676176696e67676f72646f6e2f636f6e7374616e7467726f7570732e737667)](https://github.com/gavinggordon/constantgroups/master)[![Usage License](https://camo.githubusercontent.com/83dfd945093c2d19647afffced70680b682edb07b03c602792ffddd230fcd160/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f676176696e67676f72646f6e2f636f6e7374616e7467726f7570732e737667)](https://github.com/gavinggordon/constantgroups/blob/master/LICENSE.txt)

Description
-----------

[](#description)

A PHP class which provides quick as-needed access to pre- and user defined data via constants.

Dependencies
------------

[](#dependencies)

The following dependencies will be automatically installed, if not already, when installing via composer:

- [gavinggordon/predefiner](https://github.com/gavinggordon/predefiner)

Usage
-----

[](#usage)

### Installation

[](#installation)

```
	composer require gavinggordon/constantgroups

```

### Examples

[](#examples)

#### Instantiation:

[](#instantiation)

```
	include_once( __DIR__ . '/vendor/autoload.php' );

	$constantgroups = new \GGG\Config\ConstantGroups();
```

#### Setting:

[](#setting)

Use as many or as few ConstantGroups as you want...

```
	$constantgroups->set( ['hexcolours', 'rgbcolours', 'rgbacolours'] );
```

#### Initializing:

[](#initializing)

```
	$constantgroups->init();
```

#### Utilization:

[](#utilization)

```
	echo HEX_ORANGE;
	// Result:  #FF8000
```

```
	echo RGB_ORANGE;
	// Result:  rgba( 255, 128, 0 )
```

```
	echo RGBA_ORANGE;
	// Result:  rgba( 255, 128, 0, 1.0 )
```

#### More Capabilities:

[](#more-capabilities)

Create your own named ConstantGroups...

```
	use \GGG\Config\ConstantGroups as ConstantGroups;
	use \GGG\Config\ConstantGroupCreator as ConstantGroupCreator;

	$myconstantsgroup = [
		'my application name' => 'testapp',
		'application version' => '1.4.5',
		'apphomedir' => dirname( __DIR__ )
	];

	$constantgroupcreator = new ConstantGroupCreator( $myconstantsgroup );

	ConstantGroups::create( $constantgroupcreator, 'AppData' );

	$constantgroups = new ConstantGroups();

	$constantgroups->set( ['hexcolours', 'appdata'] );

	$constantgroups->init();

	echo MY_APPLICATION_NAME;
	// Result: testapp
```

#### Issues

[](#issues)

If you have any issues at all, please post your findings in the issues page at .

#### License

[](#license)

This package utilizes the MIT License.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3390d ago

### Community

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/gavinggordon-constantgroups/health.svg)

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

PHPackages © 2026

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