PHP Classes
elePHPant
Icontem

PHP Constant Groups: Define groups of constant values from arrays

Recommend this page to a friend!
  Info   View files Documentation   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-02-23 (4 months ago) RSS 2.0 feedNot enough user ratingsTotal: 94 All time: 8,726 This week: 686Up
Version License PHP version Categories
constantgroups 1.0.0MIT/X Consortium ...5PHP 5, Utilities and Tools, Language, C...
Description Author

This class can be used to define groups of constant values from arrays.

It can take an associative array and assign constants with the name of the array keys to the respective values.

  Performance   Level  
Name: Gavin Gordon Markowski <contact>
Classes: 11 packages by
Country: Canada Canada
Age: 29
All time rank: 199950 in Canada Canada
Week rank: 183 Up3 in Canada Canada Up
Innovation award
Innovation award
Nominee: 4x

Details

ConstantGroups

Packagist Version Github Release Usage License

Description

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

Dependencies

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

Usage

Installation

	composer require gavinggordon/constantgroups

Examples

Instantiation:

	include_once( __DIR__ . '/vendor/autoload.php' );
	
	$constantgroups = new \GGG\Config\ConstantGroups();

Setting:

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

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

Initializing:

	$constantgroups->init();

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:

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

If you have any issues at all, please post your findings in the issues page at https://github.com/gavinggordon/constantgroups/issues.

License

This package utilizes the MIT License.

  Files folder image Files  
File Role Description
Files folder imagesrc (2 files, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.txt Doc. Documentation
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageGroups (8 files)
  Plain text file ConstantGroupCreator.php Class Class source
  Plain text file ConstantGroups.php Class Class source

  Files folder image Files  /  src  /  Groups  
File Role Description
  Plain text file GradientStylesConstantGroup.php Class Class source
  Accessible without login Plain text file gradient_style_data.json Data Auxiliary data
  Plain text file HexColoursConstantGroup.php Class Class source
  Accessible without login Plain text file hex_colour_data.json Data Auxiliary data
  Plain text file RgbaColoursConstantGroup.php Class Class source
  Accessible without login Plain text file rgba_colour_data.json Data Auxiliary data
  Plain text file RgbColoursConstantGroup.php Class Class source
  Accessible without login Plain text file rgb_colour_data.json Data Auxiliary data

Downloadconstantgroups-2017-02-23.zip 22KB
Downloadconstantgroups-2017-02-23.tar.gz 19KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Predefiner Download .zip .tar.gz It is required, in order to dynamically set definitions for keywords used as constants. Required
 Version Control Unique User Downloads Download Rankings  
 100%
Total:94
This week:0
All time:8,726
This week:686Up
User Comments (1)
nice
3 months ago (muabshir)
70%StarStarStarStar