Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

UweKeim's avatar

Official way to define forms?

Starting to dive into Laravel, I'm a bit confused about what is the "officially" recommended way to use forms in Laravel 5.3.

In the 5.3 documentation, the examples e.g. at laravel.com/docs/5.3/csrf use "normal" <form> tags and input fields.

In the 4.2 documentation there is a section about forms which seems to be missing in the 5.3 documentation.

It seems to me that alle newer examples I found on the web (e.g. this one) uses the Laravel Collective components to have the same form syntax that was present in 4.3.

Since these form components were removed from Laravel, there must be a reason for this descision (probably there is a more modern way of doing forms and I did not find it yet?)

Therefore my question is:

What is the officially recommended way for usage of forms (both traditional and Ajax) in Laravel 5.3?

0 likes
1 reply
katifrantz's avatar
Level 6

Taylor Otwell (creator of laravel ) said these were removed because they became a burden to the framework community , bringing too much syntax debates regarding personal preferences , and this was uncalled for . And it stills down to personal preference, some developers still install this package and use for their projects , but for the community, its generally sticking with normal forms , which think is pretty awesome by the way . Its just better not learning to many new things So a normal laravel form should look like this

<form action="{{ url('/foo') }}" method="get/post">
    {{ csrf_field() }}
    <!-- Some usual form fields -->
    <input type="submit" value="submit">
</form>

So, just your typical form . And the csrf_field here generates this :

<input type="hidden" name="_token" value="some-token like t5tkamdf663r20o)O@_@OI@#I@#died3">

This token is sent with every laravel request to prevent a fraud called CROSS REQUEST SITE FORGERY , and you can read more about this online. And of course you will see {{ csrf_token() }}, which just returns the token . Good luck bro, hope i was helpful.

2 likes

Please or to participate in this conversation.