Twig loader with database support