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

maytham's avatar

Routes.php is not working

Hej everyone, I am new in laravel just starting learning version 4.2.x I have yesterday installed version 5.0 and tried to make a simple route. It does not work as pr default installation, is there any thing I should be aware of before using route, Btw I followed the video https://laracasts.com/series/laravel-5-from-scratch/episodes/4. My test environment is on digital ocean.

0 likes
8 replies
jensig90's avatar

You can use the routes.php file by requiring routes.php in RoutesServiceProvider.php map method.

jrean's avatar
jrean
Best Answer
Level 8

@maytham Uncomment the following in app/Providers/RouteServiceProvider.php

https://github.com/laravel/laravel/blob/develop/app/Providers/RouteServiceProvider.php

/**
  * Define the routes for the application.
  *
  * @return void
  */
 public function map(Router $router)
 {
  // require app_path('Http/routes.php');
 }

@lulian_Clita I won't say it has been removed. This is not the preferred method anymore for routing BUT the functionality is still present. It's up to user to decide its favorite flavour :)

1 like
maytham's avatar

Guys that was a help, wasted around 3-4 hours google searching, now I understand. Btw I suggest the video should be updated, otherwise it makes newbies get confused. thanks every one again.

nolros's avatar

my advice right now is not to use routes.php and just stick to php annotations. I find there are a lot of problems if I use routes.php even if I remove all annotations, but seems to work fine if I just stick to annotations. Suspect it will be that way until release.

1 like
sgrayme's avatar

I'm not able to reproduce that problem and tbh, sounds like that was in the midst of people being warned Taylor was doing a handful of changes.

I made a new instance of L5 last night, after the commit-fest, and built a (really) simple article mini-site using only routes.php for defining the routes. Completely cleared out the annotations in the default auth and home controllers, and used the auth and guest middleware.

Please or to participate in this conversation.