At the moment I am auto loading my classes with:
spl_autoload_register(function ($class) {
require_once 'classes/class.'. $class .'.php';
});
And instantiating the class with:
$backend = new backend();
$dashboard = new dashboard();
$article = new article();
$video = new video();
$theme = new theme();
These are in a config file required on every action page of my admin section.
backend
is my main class holding database
functions and other global functions.
The other classes all extends
backend
.
As I understand it, I could call backend
functions through for example article
, as it is an extension of the class.
Is this a good method for instantiating the classes, or is there a way I can call them automatically without having to write these in the config file at all?