Add register_shutdown function is most accurate (and support Twig)

It's good function with Twig. You can choose position on HTML code, or just add on end file, when php code shutdown (terminate).