Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
STAFF
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.