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

TaylorOtwell's avatar

Informal Poll: Routes File

Quick little informal poll here...

Currently, Laravel 5 ships with a "routes.php" file in the App\Http directory. This file is included by the RouteServiceProvider.

Do you think we should continue to include this file by default, or let someone include their own routes file (that they create) if they wish from their RouteServiceProvider?

0 likes
216 replies
Weeblewonder's avatar

Yes still include it.

Unless you're ready for the "where do I put my routes?" questions lol

5 likes
antoineaugusti's avatar

Yes to include by default. This is a convenient place for beginners.

2 likes
lara661's avatar

No. But I like the new annotations system and plan on using that, so I guess people's reply will mostly depend on that.

TaylorOtwell's avatar

Thanks for responses so far. To ask another question: Are you satisfied with its location in Laravel 5?

11 likes
artisangoose's avatar

I vote it gets taken out. executive decisions like this have already helped me become a better developer, encouraged the implementation of better practices.

grandadevans's avatar

Hi Taylor, Many thanks for your great work. In my opinion I think the routes.php should be included by default. I for one currently have several route files that end up sort of being linked to the controllers eg SessionsController and SessionRoutes.php in a Routes dir but I still think that the user should have the choice. Especially as Laravel has a great reputation for ease of use and fantastic learning curve..

Thanks again Taylor

DrDre's avatar

Yes to keeping the example file in place.

NormySan's avatar

I think it should stay. It's good for simple stuff and throwing together things for testing purposes before moving to a different structure when your app get larger.

ekrembk's avatar

+1 for include by default and current location of the file.

Quiraily's avatar

include by default, location is fine, example is overkill.

assertchris's avatar

+1 for keeping it, even if the examples in it are commented out by default.

2 likes
PhaxeNor's avatar

My opinion is split. But maybe add a route command to create the Router files that is needed to use the "router.php" file and then leave it out by default. As long as it possible

Adam Kelso's avatar

Please keep the file. It makes sense where it is. Should be placed with controllers.

2 likes
melis's avatar

i think it would be better in Routes folder

michaeljcalkins's avatar

I use your default files as examples to learn and build from. So +1 for keeping it.

vjacob's avatar

Yes to include by default, but I'd like it to be moved to the resources directory maybe? I like the idea of having only classes under the App directory. What do you guys think?

IsraelOrtuno's avatar

I'm happy with the current file location. Also good for beginners as @antoineaugusti said.

There are hundreads of tutorials at the moment talking about that file and it's like the "official" starting point for any newbie since older versions.

1 like
ratiw's avatar

+1 for keeping it and where it is as people have already learned where it is. Easier for beginner and more advanced users will definitely going for service provider and/or annotations.

rspahni's avatar

+1 keep it pls / location makes sense / examples, too.

JeffreyWay's avatar

But think about whether it will confuse newcomers, when they see a routes.php file, but also route annotations in the sample HomeController.

Does Laravel want to encourage the use of route annotations, or just provide them as an option? That's a very important question.

8 likes
vjacob's avatar

As for confusion, just put comments in the routes.php file explaining that you can use route annotations. This is a great place to introduce newcomers to the annotations as well. Personally, i'll use annotations, but routes.php file is important for newcomers.

1 like
gregrobson's avatar

Keep, only large/complex applications might need change the structure and deviate from a plain old routes file. Let developers decide when it's time and avoid premature optimisation..

2 likes
Next

Please or to participate in this conversation.