Can I configure PHP to automatically format the HTML it generates?
<p>For example…</p>

<p>This PHP code</p>

<pre><code>&lt;?php
echo '&lt;html&gt;';
echo '&lt;body&gt;';
echo '&lt;h1&gt;Header One&lt;/h1&gt;';
echo '&lt;p&gt;Hello World!&lt;/p&gt;';
echo '&lt;/body&gt;';
echo '&lt;/html&gt;';
?&gt;
</code></pre>

<p>Generates this HTML markup</p>

<pre><code>&lt;html&gt;&lt;body&gt;&lt;h1&gt;Header One&lt;/h1&gt;&lt;p&gt;Hello World!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
</code></pre>

<p>Are there any functions, libraries or configuration options to make PHP automatically apply some simple formatting (line breaks &amp; indentation) based on the nesting of html tags generated in the output? So that instead something like this would be generated…</p>

<pre><code>&lt;html&gt;
      &lt;body&gt;
            &lt;h1&gt;Header One&lt;/h1&gt;
            &lt;p&gt;Hello World!&lt;/p&gt;
      &lt;/body&gt;
&lt;/html&gt;
</code></pre>
