Support the ongoing development of →
Last updated 2 years ago.

Hello Anyone having the issue?


Hi ! I had the same problem. I added this function to Laravel\Lumen\Application.php

 * Register a resource with the application.
 * @param  string  $uri
 * @param  mixed  $controller
 * @return $this
public function resource($uri, $controller)
    $this->get($uri, 'App\Http\Controllers\\'.$controller.'@index');
    $this->get($uri.'/create', 'App\Http\Controllers\\'.$controller.'@create');
    $this->post($uri, 'App\Http\Controllers\\'.$controller.'@store');
    $this->get($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@show');
    $this->get($uri.'/{id}/edit', 'App\Http\Controllers\\'.$controller.'@edit');
    $this->put($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@update');
    $this->patch($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@update');
    $this->delete($uri.'/{id}', 'App\Http\Controllers\\'.$controller.'@destroy');
    return $this;
Last updated 9 years ago.

You can follow what @diegomariani did. While you're at it, check this out:

Last updated 9 years ago.

If you're having to go through all that you may as well just install and use Laravel.

Last updated 9 years ago.

@jimgwhit are you referring to the gists I gave? could you give a reason why?


The lumen docs shows how to route. But it's in the controllers section of the docs. If you have to keep adding tons of code to make lumen work like laravel, yek may as well use laravel. But you have good code, and your code is always useful.


jimgwhit said:

If you're having to go through all that you may as well just install and use Laravel.

Sorry to revive an old thread, but I keep seeing this dismissive kind of response to this question everywhere and I feel it's the kind of thinking that discourages people from trying to make something better. Resource routing is not an unreasonable wish for Lumen. Lumen is geared toward developing APIs. I actually care more about my APIs following good REST conventions than I do about apps that render HTML, most of the time. IMO Lumen ought to make it easy.

I presume that Lumen doesn't have resource routing (yet) because its router is based on FastRoute instead of Laravel's router, so work of implementing resource routing on top of it just hasn't been done yet. I bet it's achievable without a serious performance sacrifice. I'd love to see it proposed as a feature for future versions.

Thanks @diegomariani and @beanmoss for sharing your code, very handy.


Sign in to participate in this thread!


Your banner here too?

sohelamin sohelamin Joined 21 Apr 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.