Using a registry with static container I am currently working on a class to make objects and vars available to child classes while attempting to avoid a singleton. Each child with dependencies extend this class and pass params (var names) of required dependencies. If parent construct is called and params is empty full registry is set.

Example of Registry:

class Registry {   
public static $registry = []; 

public function __construct($DI = '') {
    if (self::$registry) {

        /**
         *  $DI List Missing Pass Entire Registry
         */
        if (!$DI) {
            foreach (self::$registry as $var =&gt; $value) {
                $this-&gt;$var = $value; 
            }
        }

        /**
         *  $DI List Set, Pass Specific Dependencies
         */
        else {
            foreach ($DI as $dependency) {

                    if (isset(self::$registry[$dependency])) {
                        $this-&gt;$dependency = self::$registry[$dependency];
                    } 
                    else {
                        if (ENVIRONMENT == 'development') {
                            echo get_called_class().' Needs Dependency '.$dependency.'&lt;br /&gt;&lt;br /&gt;';
                        }
                    }

            }
        }
    }
}  


/**
 *  Add to Registry
 */
public static function add($array, $type = 'class', $namespace = '') {
    foreach ($array as $var =&gt; $value) {
        if (!isset(self::$registry[$var])) { 

            switch ($type) {
                case 'class':
                    $class                  = $namespace.$value;   
                    self::$registry[$var]   = new $class; 
                    break;

                case 'var':
                    self::$registry[$var]   = $value;
                    break;
            }  

        }
    }
}


private function __clone() {}
private function __wakeup() {}
}


Adding and using vars/objects from registry is easily done through static calling, but the main point of this class is to pass dependencies to child classes. I am wondering if there are drawbacks that someone with more experience would know of/find.
I think the proposed solution is bad. There is no room for lazy loading. All dependencies need to be defined for this 'registry' class. The registry class thus becomes all knowing. All other classes extend Registry, thus are all knowing as well. If you think that is no problem? then stop reading and continue

Another problem: objects are passed around by reference, vars are copied. Is this desired?

What if the $class needs different parameters set depending on where it is used?

Lets look at the following situation:
Both the database and the mailer need a LoggerInterface. So they have a dependency of 'LoggerInterface'. The database however logs to a file, and the Mailer logs to the database. How do you solve this? Have the Mailer depend on a DatabaseLogger?

So to be able to use your Registry, we can no longer hint for generic interfaces, but we hint for concrete classes.