Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP User Authentication Building the Library Building the Book List

Filter data - The HttpFoundation Component

After using The HttpFoundation Component is we don't need to filter form data.

1 Answer

Brian Retterer
Brian Retterer
Treehouse Guest Teacher

Mudit, Using the Symfony HTTP Foundation package makes it so you dont have to use the GLOBAL variables ($_GET, $_POST, etc).

You should never trust data that can be submitted by an end user so you should filter it. Symfony gives you some help with that,but you can also go the extra mile and run their function $request->request->filter('email', 'default value', false, INPUT_VALIDATE_EMAIL); which will validate an input with the name of email and make sure it is a valid email address.