I have been researching this extensively, and I am stuck. I am writing a Drupal module that uses a class that I have created. This class is a classic Singleton - it only needs to be instantiated once, since it is assembling a bunch of data from a database. Note that my potential Singleton will not update any data in the database - it will just read from existing data. Also, note that processes outside the context of my program may update the data.I know the take home answer here is 'use Dependency Injection'. However, I can not use Dependency Injection - Drupal uses hooks, and these hooks accept certain parameters. I.e., I can't (to my knowledge) insert a object that way.I should point out that testing is a concern of mine as well (although testing my module in Drupal has had its own series of challenges). However, I am willing to accept that a Singleton may be the lesser of two evils here.Here is an example:function mymod_block_view($var) {    //$var is required by drupal    $obj = new Object()    ....}function mymod_block_info() {    ...     $obj = new Object()}My options right now are to use a global variable (not ideal) or a Singleton (according to my research, also not ideal, but may be my only option). Do I have any other options, besides declaring a new variable object inside each function?
Alternative to Singleton when D.I. is not an option
web development;php