title: How to avoid using PHP global objects?
body: <p>I'm currently creating blog system, which I hope to turn into a full CMS in the future.</p>
  
  <p>There are two classes/objects that would be useful to have global access to (the mysqli database connection and a custom class which checks whether a user is logged in).</p>
  
  <p>I am looking for a way to do this without using global objects, and if possible, not passing the objects to each function every time they are called.</p>