PHPackages                             fremail/lumen-nested-route-groups - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. fremail/lumen-nested-route-groups

ActiveLibrary[Framework](/categories/framework)

fremail/lumen-nested-route-groups
=================================

Extends a lumen application for using nested route groups. In addition to the groups it's possible to use any() and match() methods.

1.1.0(9y ago)1511.0k6MITPHPPHP &gt;=5.5.9

Since Sep 22Pushed 9y ago2 watchersCompare

[ Source](https://github.com/fremail/lumen-nested-route-groups)[ Packagist](https://packagist.org/packages/fremail/lumen-nested-route-groups)[ RSS](/packages/fremail-lumen-nested-route-groups/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Changelog
=========

[](#changelog)

**v.1.1.0** Add [$app-&gt;any() and $app-&gt;match() methods](#any-and-match-methods) (no breaking changes)

Lumen nested route groups
=========================

[](#lumen-nested-route-groups)

Extends a lumen application for using nested route groups. Lumen already uses a group in bootstrap/app.php, that is why you can't use another groups in app/Http/routes.php. This lib removes the restriction.

How to install (steps)
----------------------

[](#how-to-install-steps)

### 1. Install using Composer

[](#1-install-using-composer)

```
composer require "fremail/lumen-nested-route-groups:~1.1"

```

### 2. Required changes in bootstrap/app.php

[](#2-required-changes-in-bootstrapappphp)

Change initialization of Lumen Application class to initialization of Lumen Nested Route Groups Application class in bootstrap/app.php.

Before:

```
$app = new Laravel\Lumen\Application(
    realpath(__DIR__.'/../')
);

```

After:

```
$app = new Fremail\NestedRouteGroups\Application(
    realpath(__DIR__.'/../')
);

```

### After these simple steps you can use nested route groups in your application!

[](#after-these-simple-steps-you-can-use-nested-route-groups-in-your-application)

Additional namespaces configuration
-----------------------------------

[](#additional-namespaces-configuration)

By default this lib uses nested namespace ([Laravel style](https://laravel.com/docs/5.2/routing#route-group-namespaces)), but you can determine to use full namespaces instead ([Lumen style](https://lumen.laravel.com/docs/5.2/routing#route-group-namespaces)).

**Steps for using full namespaces:**

1. Create `config` directory if you don't have one in the project root.
2. Copy `NestedRouteGroups.php` from `vendor/fremail/lumen-nested-route-groups/config` folder to the created `config` dir in the root.
3. Open the `config/NestedRouteGroups.php` file and set 'namespace' value to 'full'.
4. Add this line to your bootstrap/app.php: `$app->configure('NestedRouteGroups');`

Any() and Match() methods
-------------------------

[](#any-and-match-methods)

Do you like `any()` and `match()` methods on Laravel? I love them! That's why I added supporting them on Lumen. The syntax is the same as for [Laravel](https://laravel.com/docs/master/routing#basic-routing):

```
$app->match($methods, $uri, $action);

```

Where *$methods* - an array of methods. Example: `['get', 'post', 'delete']`. *$uri* and *$action* are the same as on other methods

```
$app->any($uri, $action);

```

Here are *$uri* and *$method* are the same as on other methods like `$app->get(...)` etc.

Example of using this lib
-------------------------

[](#example-of-using-this-lib)

This is an example of app/Http/routes.php

```
$app->group(['middleware' => 'auth'], function () use ($app) {

    $app->get('test', function () {
        echo "Hello world!";
    });

    $app->group(['prefix' => 'user'], function () use ($app) {
        $app->get('{id}', 'UserController@show');
        $app->post('/', 'UserController@store');
        $app->delete('{id}', 'UserController@destroy');
    });

    /**
     * only admins
     */
    $app->group(['middleware' => 'admin'], function () use ($app) {

        $app->group(['prefix' => 'admin'], function () use ($app) {
            $app->get('/', 'AdminController@index');
        });

    });

    /**
     * $app->any and $app->match available from v1.1.0
     */
    $app->any('/', function () use ($app) {
        echo "Hey! I don't care it's POST, GET, PATCH or another method. I'll answer on any of them :)";
    });

    $app->match(['PATCH', 'PUT', 'DELETE'], '/old/', function () use ($app) {
        echo "This is an old part of our site without supporting REST. Please use only GET and POST here.";
    });

});

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~138 days

Total

4

Last Release

3464d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9650317364ca9f1b764127f643a148336cdc7ee08af76bcc153c73337d2eb7f7?d=identicon)[fremail](/maintainers/fremail)

---

Top Contributors

[![fremail](https://avatars.githubusercontent.com/u/12110440?v=4)](https://github.com/fremail "fremail (12 commits)")[![AsafMah](https://avatars.githubusercontent.com/u/6424271?v=4)](https://github.com/AsafMah "AsafMah (1 commits)")

---

Tags

lumenrouteMatchgroupany

### Embed Badge

![Health badge](/badges/fremail-lumen-nested-route-groups/health.svg)

```
[![Health](https://phpackages.com/badges/fremail-lumen-nested-route-groups/health.svg)](https://phpackages.com/packages/fremail-lumen-nested-route-groups)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
