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

SNaRe's avatar

Routes.php is back as default ( New Commit )

I was checking github for new commits and I saw this "Changing default routing setup."

https://github.com/laravel/laravel/commit/0ee0c434a3760ae03ff84545c8a298c00dccb15d

If I am not mistaken routes.php is back as default.

0 likes
31 replies
imJohnBon's avatar

Very curious to see the reasoning here. Taylor made a tweet a few days ago about how he was dogfooding a Laravel 5 app and saw certain areas for improvement. Maybe he realized he didn't like annotations as much as he thought? Or doesn't think they're right for people just using the framework for the first time? Super interesting.

SNaRe's avatar

In my humble opinion, the next roll-back should be Whoops to be default error handler.

1 like
JeffreyWay's avatar

Yeah, consider everything to be in flux until December or January. Nothing is set in stone yet.

imJohnBon's avatar

@diego1araujo No I saw. But after that thread, routes.php was removed and it seemed like things were moving full on forward with annotations being the recommended method for defining routes. This now reverses that, with annotations being AN option but not THE option. My main curiosity is, are annotations still going to be Taylor's recommendation/preference despite no longer being the default. It doesn't really matter, I'm still probably going to stick with routes.php for the time being, I'm just curious to see what the general population swings toward once they've had the chance to digest annotations a bit more in practice. Or will removing them as the default basically kill any chance of them being widely adopted.

bashy's avatar

I think it's better this way around. Have routes.php by default and if you want to use a more advanced way, you setup annotations instead...

1 like
pffred's avatar

I've been using annotations with Symfony for a while; never bothered me and made my workflow way more easier.

unitedworx's avatar

Yeah, routes.php would be better kept there by default so it wont allienate anyone.

I am sure as soon as people realize how simpler things are with annotations they will jump right into them and maybe leave that routes.php file there for writing a quick closure to test something out.

P.S anyone knows if @Any is supported in annotations? Yesterday that was trying it didn't work and was not sure where to look into finding exactly whats available for route annotations

Morgon's avatar

@unitedworx - Not currently, according to the docs. There are definitely some cool features of 'typical Laravel routing' that don't have any love in the Annotation parser.

usman's avatar

When asked for the reason behind putting back the routes.php, this is how taylor replied:

"I found it a more understandable starting point when I was building a recent L5 app."

I am hopping to see 'Whoops' back as well :)

1 like
Morgon's avatar

I was rather surprised by that response, quite honestly.. just given the way he and @JeffreyWay first introduced it as being more of a 'no-brainer' than the routes file.

This isn't faulting them, of course; needs and situations change. People will use them where they make sense, and won't when they don't, and the world will continue to turn.

lara9849's avatar

I think i am not the only one to think i am in two minds about the feature.

milon's avatar

great, hope whoops will be back soon.

fdusautoir's avatar

So now, is it still possible to use "Route annotations" ? If yes, how to proceed ?

pmall's avatar

Best laravel news of the month.

:)

1 like
fdusautoir's avatar

Just find the solution to my question, just re-add the scan array to the RouteServiceProvider file and that's do the trick.

1 like
bart's avatar

In my opinion the new route annotation feature is awesome and last but not least you guys have the choice of using either annotations or the good old routes.php file. So can't understand any reverts. I like the idea of modularity so Whoops does not really be included as default.

In my opinion it's just a question of documentation. If you could add modules like Whoops in a fancy easy way - this would be perfect for me.

1 like
dberry's avatar

I still don't understand what the fuss was about and the comments like "now least you guys have the choice of using either annotations or the good old routes.php file" or "this is the best news" or why the commit even made headlines, because the old way of routes never went away, it wasn't hidden anywhere, this whole time it's been just as easy and right in your face to use as it has always been and not once anywhere did Taylor ever even mention routes going anywhere. Really if you look at it, even the generated routes scan file was just a routes file.

It just feels like and has felt like a lot of ruckus about nothing over code that everyone has been strongly encouraged by the dev (taylor) to not use other than playing around with it.

2 likes
Morgon's avatar

@dberry - For me specifically, I consider anything coming from laravel/laravel or laravel/framework to be 'the software'. With the exception of config files (which are obvious that they need to be changed), I don't want to futz around with what feels like non-standard changes to these files that we aren't that familiar with.

L5 is a big change for a lot of people, and just by virtue, they're going to consider what's there to be 'the way'; and since people are resistant to change (and generally lazy (raises hand)), it may have been jarring.

Of course, I do think there was a lot of unnecessary rabble-rousing on Annotations; after I learned a bit about what methods were compatible, I was able to implement what I wanted. I enjoy them - and to touch on that lazy/scared concept I mentioned, I hope I don't have to make any changes to re-add support for them :) However, they are still relatively limiting if you have advanced routing setups, and so they're not for everyone in every project.

Additionally, I firmly believe part of the blame can be aimed towards the lack of documentation. The LC video on the subject was great, but there was still no comprehensive reference like there is for the routes.php approach. L5 is barely beta, of course, but the feature is simply ahead of its time without the details on what it can and cannot do.

Having said all that, I hope Taylor doesn't fully abandon Annotations, and has an opportunity to flesh it out more to handle some of the 'advanced routing' use-cases. There are many situations where it really makes the most sense, and I suspect a good bit of the resistors could/would have used them with the proper assurances (supporting documentation).

1 like
bart's avatar

That's what I said. Its just a topic of documentation later an in the final release. Guys, we are in alpha state now, so don't complain about things like this.

When we stay where we are someday another framework will pass Laravel.

It's one of the oldest topics in web development. People like software they know about and feel comfortable with, because they are fast in using it. Learning new things always results in a lose of time - but exactly that time is needed to develop the future!

dberry's avatar

My point really was

1) it's in development so no documentation needed right now. it's for those who can read through the code and know what is going on. Not for people who need their hands held. Using a framework that's in alpha will "always result in a loss of time"

2) Routes NEVER went anywhere, they NEVER disappeared and they still functioned like normal. Even the annotations spat out a routes file. That was to comments like "Best laravel news of the month.", "Finally", etc...

As to the whole default versus non-default, I think Taylor answered that best "What are you even talking about. Nothing uses annotations by default."

JeffreyWay's avatar

Yeah - let's not complain that there is no documentation for alpha software. That's absurd.

5 likes
landjea's avatar

2) Routes NEVER went anywhere, they NEVER disappeared and they still functioned like normal. Even the annotations spat out a routes file. That was to comments like "Best laravel news of the month.", "Finally", etc...

That's a bit disingenuous. They did not function like normal. Some work was required to get routes.php functional again and some of the previous functionality with routes was not readily available.

dberry's avatar

@landjea, you literally uncommented like 8 lines and hit CMD+N to create a file called routes.php. It takes more effort to sneeze then it does to do that.

It wasn't something that needed documentation either, because he told you exactly what to do in the comments and in the commits.

ovidiu_dtp's avatar

Is good to have the file by default. The fact that you can add it with low effort is not an argument to have it removed by default. People can remove it with even less effort when they understand why to do it. The point is, that for noobs is a great help to keep things as consistent as they can be. For those with experience... they don't need that much help in designing the structure they need.

Morgon's avatar

@dberry - I'm not disagreeing with you, but that's simply not how widely-used software works. Not everyone is poring over the commits and comments; I'd venture that a good chunk of people had adopted Laravel specifically so they didn't have to. There are 2.5 million downloads on Packagist for laravel/framework, which completely ignores zip- and git-based installs.

L4 made development very simple, and was specifically billed that way. So you can't really blame people for wanting something that Just Works(TM). In addition to Taylor's comment that he suddenly found it more intuitive, it's not too hard to believe that public sentiment played a factor.

I almost feel there should be some better abstraction to these two approaches to the point where it's just a 'flick of a switch' (in terms of a configuration field) to select which one to use. That way there's not a whole lot of code wrangling to choose which one you want.

ratiw's avatar

routes.php is back as the default is good and I personally think that it is great for newcomers. But I once L5 is stable, I'm all in to the annotation! :)

Next

Please or to participate in this conversation.