Store header and footer in separate phtml files

I would like to store the header and footer in their own phtml files and include them in the main page.

It was possible under Zend. how can one accomplish there under laminas

I think you mean “Zend Framework”, but since version 1 and 2 of ZF, and also laminas-view you don’t need separate files for header and footer. You can use a layout next to your view script.