I think a better way to use your framework is through a singleton function as follows. It's better than static class because then you can easily set (global) variables without the need for any separate get(), set(), has() functions.
function app() {
static $app;
if (!$app) $app = new flight\Engine();
return $app;
}
app()->config = require 'config.php';
app()->db = new PDO('mysql:host=localhost;dnbname=test','user','pass');
..
app()->start();
Hey Mike,
I think a better way to use your framework is through a singleton function as follows. It's better than static class because then you can easily set (global) variables without the need for any separate get(), set(), has() functions.
function app() { static $app; if (!$app) $app = new flight\Engine(); return $app; }
app()->config = require 'config.php'; app()->db = new PDO('mysql:host=localhost;dnbname=test','user','pass'); .. app()->start();
Thanks for the great framework.