title: How do I apply URL normalization rules in PHP?
body: <p>Is there a pre-existing function or class for URL normalization in PHP?</p>
  <p>Specifically, following the semantic preserving normalization rules laid out in this <a href="http://en.wikipedia.org/wiki/URL_normalization" rel="noreferrer">wikipedia article on URL normalization</a>, (or whatever 'standard' I should be following).</p>
  <ul>
  <li>Converting the scheme and host to lower case</li>
  <li>Capitalizing letters in escape sequences</li>
  <li>Adding trailing / (to directories, not files)</li>
  <li>Removing the default port</li>
  <li>Removing dot-segments</li>
  </ul>
  <p>Right now, I'm thinking that I'll just use <code>parse_url()</code>, and apply the rules individually, but I'd prefer to avoid reinventing the wheel.</p>