-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Rename routes.php to indicate the name of the middleware group of the routes it contains #3772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@philbates35 I've taken the foldered approach on a recent project and it definitely feels neatest to me. In my own case I've gone for
But I think having a default of Routes/web.php makes perfect sense for people new to the framework. |
You can add api routes in your RouteServiceProvider and include your routes file . |
@@ -17,7 +17,7 @@ | |||
<whitelist processUncoveredFilesFromWhitelist="true"> | |||
<directory suffix=".php">./app</directory> | |||
<exclude> | |||
<file>./app/Http/routes.php</file> | |||
<file>./app/Http/Routes/web.php</file> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just exclude the entire Routes folder please.
@GrahamCampbell I've updated |
@@ -17,7 +17,7 @@ | |||
<whitelist processUncoveredFilesFromWhitelist="true"> | |||
<directory suffix=".php">./app</directory> | |||
<exclude> | |||
<file>./app/Http/routes.php</file> | |||
<file>./app/Http/Routes</file> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work. It's not a file
you're excluding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need <directory>./app/Http/Routes</directory>
.
@GrahamCampbell Changed |
Looks like overkill to me but could actually clean up our stuff quite a bit since we have a massive routes.php file. |
Holding off on this. Obviously you are free to change it to whatever you want in your own apps. |
Following on from #3724, I'm opening this here to continue the discussion on
develop
as requested by Taylor.If all the routes in
routes.php
are in theweb
middleware group, then that immediately begs the question what do I call the routes file that that will contain theapi
middleware group routes? Probably eitherroutes-api.php
orapi.php
, so if you went with that ideally you would want to be consistent and would renameroutes.php
toroutes-web.php
orweb.php
to match. Not doing so would result in havingroutes.php
androutes-api.php
orapi.php
, and that lack of consistency seems a little sloppy.Personally I think keeping all routes files in a separate directory to avoid the
routes-
prefix of the routes files is preferable, (one file per middleware group) so that's what I've done here, but I'm happy to change it if others prefer.The main issue is the inconsistency of having a specific middleware group routes file being given a general, non-specific name.