I am working on some PHP classes, I have a session class used to set and get values to session variables, I will need to have access to this session class object in every other class so I made a singleton method in the session class and then in other class's methods I can call the session object like this....
$session = Session::getInstance();
This will return the session object to me to use or else start a new session object if one has not been started yet.
So my question, if I have a user class and a database class and each class had 10 methods in each that needs to access the session object, then would I need to run the code above inside each and every method or just 1 time inside the class and then all methods would have it? I am new to this so I am not sure??? Thanks