e() helper notes

Paul Brown · 10/05/2024 · 1 min read


Research on e() helper for blog post

  • Laravel's first documentation from late 2011 -- found here -- references this method for encoding HTML entities:
echo HTML::entities('<script>alert('hi');</script>');
  • This method has become the e() helper by version 3:
function e($value)
{
	return HTML::entities($value);
}

Between Laravel versions 5.2 and 5.3 the helper stopped using htmlentities() and started using htmlspecialchars(). See documentation here for 5.2 and here for 5.3

  • e() helper method added with this commit on 5 November 2011, ready for the Laravel 3.0 release. No note about its naming, can only assume its an abbreviation of "entities".

Discussions

Login to Post Comments
No Comments Posted