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

Nesting route groups doesn't work #85

Closed
thasmo opened this Issue May 7, 2015 · 7 comments

Comments

Projects
None yet
7 participants
@thasmo

thasmo commented May 7, 2015

My routes.php looks like this:

// API v1
$app->group(['prefix' => 'v1'], function($app) {
    $app->get('/', function() {
        return 'root';
    });

    // Users
    $app->group(['prefix' => 'users'], function($app) {
        $app->get('/', function() {
            return 'users';
        });
    });
});

When calling /v1 it returns root, but when calling /v1/users a NotFoundHttpException is thrown. This works in Laravel as far as I know. Is this intentionally not working in Lumen? FastRoute doesn't provide the route grouping itself, that's why I thought it may be a bug in Lumen.

@GrahamCampbell

This comment has been minimized.

Show comment
Hide comment
@GrahamCampbell

GrahamCampbell May 7, 2015

Member

Lumen's routing is intentionally simpler so that performance is maximal. I don't think nested groups are supported.

Member

GrahamCampbell commented May 7, 2015

Lumen's routing is intentionally simpler so that performance is maximal. I don't think nested groups are supported.

@jasonlewis

This comment has been minimized.

Show comment
Hide comment
@jasonlewis

jasonlewis May 7, 2015

Contributor

Nope, nested groups aren't supported.

The second route would be available at /users because it overwrites the group attributes set by the first group. Lumen doesn't keep track of a group stack like Laravel.

Contributor

jasonlewis commented May 7, 2015

Nope, nested groups aren't supported.

The second route would be available at /users because it overwrites the group attributes set by the first group. Lumen doesn't keep track of a group stack like Laravel.

@Kristories

This comment has been minimized.

Show comment
Hide comment
@Kristories

Kristories Jun 12, 2015

So sad nested group aren't supported.. But, you can use this method :

$app->group(['prefix' => 'v1/users'], function ($app)
{
    $app->get('/', function () {
        // Matches The "/v1/users" URL
    });
});

Kristories commented Jun 12, 2015

So sad nested group aren't supported.. But, you can use this method :

$app->group(['prefix' => 'v1/users'], function ($app)
{
    $app->get('/', function () {
        // Matches The "/v1/users" URL
    });
});
@fremail

This comment has been minimized.

Show comment
Hide comment
@fremail

fremail Aug 31, 2015

If somebody needs, I made a small lib to fix nested route groups problem: https://github.com/fremail/lumen-nested-route-groups

fremail commented Aug 31, 2015

If somebody needs, I made a small lib to fix nested route groups problem: https://github.com/fremail/lumen-nested-route-groups

@atapatel

This comment has been minimized.

Show comment
Hide comment
@atapatel

atapatel Jan 7, 2016

+1 for this feature in future release.

atapatel commented Jan 7, 2016

+1 for this feature in future release.

@drm2

This comment has been minimized.

Show comment
Hide comment
@drm2

drm2 Jan 21, 2016

I agree with @atapatel. There is no reason this can't be included, but disabled, by default. Please add this feature.

drm2 commented Jan 21, 2016

I agree with @atapatel. There is no reason this can't be included, but disabled, by default. Please add this feature.

@laravel laravel locked and limited conversation to collaborators Jan 21, 2016

@GrahamCampbell

This comment has been minimized.

Show comment
Hide comment
@GrahamCampbell

GrahamCampbell Jan 21, 2016

Member

There are no plans to add this feature. Please use laravel/framework if you want this.

Member

GrahamCampbell commented Jan 21, 2016

There are no plans to add this feature. Please use laravel/framework if you want this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.