This class (GGG\Config\Predefiner) is a simple package to quickly and dynamically set PHP constants.
composer require gavinggordon/predefiner
include_once( __DIR__ . '/vendor/autoload.php' );
$predefiner = new \GGG\Config\Predefiner(); $predefiner->set( ['API_KEY' => 'abc123def456hij789klm0'] ); $predefiner->init();
echo API_KEY;
// Result: 'abc123def456hij789klm0';If you have any issues at all, please post your findings in the issues page at https://github.com/gavinggordon/predefiner/issues.
This package utilizes the MIT License.