Level 3
Needed to exclude the route from csrf protection.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I am testing some API patterns for a potential project on Laravel 5.1 and the results are not clear.
I have defined the following route in routes.php
Route::any('test/api/get', function() {
return $_SERVER['REQUEST_METHOD'];
});
When I use curl with with GET verb the results are fine, when I try
curl -X PUT example.comit says something went wrong.
How's laravel 5.1 handling the verbs of restful? I notice the html forms are using _METHOD as a hidden input to pass the verb. But I assume normal rest api requests are handled as well by laravel?
Needed to exclude the route from csrf protection.
Please or to participate in this conversation.