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

The HttpFoundation Component

Will anyone explain me the benefits of using this component.

1 Answer

Brian Retterer
STAFF
Brian Retterer
Treehouse Guest Teacher

Mudit, In the video on Cookies vs Sessions, https://teamtreehouse.com/library/cookies-vs-session-storage, we talk about how one of the main benefits of using the package falls on the ease to set cookies. Some of the other features of the package are to provide you with Constants for your HTTP Status Codes, as well as ease of access for the request object, giving you access to POST variables.

You can see all it can do for you at http://symfony.com/doc/current/create_framework/http_foundation.html

Ksenia Breitenmoser
Ksenia Breitenmoser
20,874 Points

Brian, based on your comment I have a question regarding the Constants. So once lets say book form is submitted, in add.php procedure file we can access the $_POST variable with request method and work with them. However if there was any problem with add.php procedure, the user gets redirected back to registration form page. My question here is: can I use on this registration page again those constants from request object? I want to fill in the form with what user provided before. I have tried and it didn't seem to work for me. I could not extract those variable from the request object. Thank you very much!