config; // Start database connection $database = new Database($config['database']); // Session wrapper $session = new Session; // Handles current user session $user = new User($session, $database); // Decides if the user is allowed to view current page new AccessControl($user); $app = new App( $config, $database, $session, $user ); // We will use $app instead unset( $config, $database, $session, $user ); return $app;