Skip to content

Add QUERY route method support#60650

Closed
Afcyy wants to merge 2 commits into
laravel:13.xfrom
Afcyy:add-query-route-method-support
Closed

Add QUERY route method support#60650
Afcyy wants to merge 2 commits into
laravel:13.xfrom
Afcyy:add-query-route-method-support

Conversation

@Afcyy

@Afcyy Afcyy commented Jul 3, 2026

Copy link
Copy Markdown

This PR adds first-class routing support for the HTTP QUERY method.

Laravel already supports custom methods through Route::match() and Router::addRoute(), but there is no native Route::query() helper like there is for get, post, put, patch, delete, and options.

With this change, applications can define QUERY routes directly:

Route::query('/search', function () {
    return request()->input('filter');
});

QUERY is also included in Route::any(), exposed through the route registrar and facade docs, and treated as a read request by PreventRequestForgery.

That last part is important because QUERY is defined as a safe HTTP method, so it should behave like GET, HEAD, and OPTIONS for CSRF purposes.

Tests cover direct router dispatching, route registrar usage, framework integration, cached routes, and CSRF middleware behavior.

@taylorotwell

Copy link
Copy Markdown
Member

Since you're updating a contract this would need to go to master branch. Thanks!

@Afcyy

Afcyy commented Jul 3, 2026

Copy link
Copy Markdown
Author

Thanks, I'll retarget this to master.

@Afcyy

Afcyy commented Jul 3, 2026

Copy link
Copy Markdown
Author

I opened a new PR targeting master with the same change, rebased cleanly: #60655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants