I found out a neat way to centralize one single class which will give accessibility to other classes. I also added a parameter to the __construct method which would be an array of classes you want loaded. This isn't completely necessary, but it will stop "excessive memory" if you're loading a bunch of unused classes.
<?php
class Bot {
private $classes = array (
'Socket' => "connection/class.Socket.php",
'Input' => "io/class.Input.php",
'Output' => "io/class.Output.php",
'Parse' => "io/parse/class.Parse.php"
);
public $Socket, $Input, $Output, $Parse; public function __construct($load=false){
if(is_array($load)){
foreach($load as $class){
if(isset($this->classes[$class])){
require($this->classes[$class]);
$this->$class = new $class($this);
}
}
} else {
foreach($this->classes as $class => $path){
require($path);
$this->$class = new $class($this);
}
}
}
}
?>