Try passing the variable that you want to be global to the object as an argument, and then use the __constructor() method to make it a class property.
You can find more info and examples here:
In php when initializing a class how would one pass a variable to that class to be used in its functions?