I have a server running a API using Slim.
Each API request points to PHP code / functions divided in different PHP files. I'm not so heavy into PHP, and now I'm passing or setting variables in each class where needed.
I'm Wondering if there isn't a better way to set a REQUEST SCOPE 'global' variable that can be shared across the different PHP files? But are not shared between all the incoming request.
Should I:
- Work with Sessions?
- Work with a Singleton?
- ...
Code examples are difficult to give. This question fits more into a conceptual question.
Any good advice into accomplishing the sharing of variables across multiple PHP files, but with the REQUEST scope?