I hacked into L4 a bit today trying to see if a route could be cached the way they are doing caching in L5, which would be another option in the future.
I was not successful at caching a route object. The route object can have no closures because of the inalienability to serialize a closure. In L5 the route object is trimmed down and has no closures in its base object code which allows for it to be serialized then just loaded and used as a route object.
Now in L4 if you remove any closures from the routes.php and use controllers, it still sets a closure on the the action['uses'] by default. So far everything I tried to replace that failed. I'm sure it could be done, but it would take a lot more modification to the core to get it to work. However it was fun and now I understand L5 routing a little better.
You could try using Route::Groups .. I already shutdown my Dev stuff or I'd check, but I think the Route::Group sub-routes are not parsed if the group is not a match to the request, but not 100% on that.
Another possibility for you to trim your route loading.
if (Request::is('admin/*'))
{
require __DIR__.'/admin_routes.php';
}
from http://laravel-news.com/2014/04/laravel-tip-break-up-your-routes/
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community