I have a set of API keys that are constant across my codebase - I have a dev key and a live key. They are stored in their own 'keys.php' file.
I have a class that handles accessing the API and I am storing the keys in the class as class constants.
I want to be able to swap out the dev keys for live keys and access them in a static method of my class.
This works fine when I assign the class constant like this:
const API_USER_NAME = 'user_name';
But want to store the keys in their own file, and include them into the class file, and define those constants as such:
const API_USER_NAME = $user_name;
But apparently I can't assign a variable to a constant, even though that variable will not change value during execution of the program.
Is there another way I can use a variable to assign to a constant? Or at least, keep they keys in their centralized file, but still access them in the static methods of my class?