PHPackages                             theanadimukt/routes-dir-iterator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. theanadimukt/routes-dir-iterator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

theanadimukt/routes-dir-iterator
================================

Iterate nested directories for segregated routes

1.1(3y ago)018[3 PRs](https://github.com/theanadimukt/routes-dir-iterator/pulls)MITPHPPHP ^8.0

Since May 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/theanadimukt/routes-dir-iterator)[ Packagist](https://packagist.org/packages/theanadimukt/routes-dir-iterator)[ Docs](https://github.com/theanadimukt/routes-dir-iterator)[ GitHub Sponsors](https://github.com/theanadimukt)[ RSS](/packages/theanadimukt-routes-dir-iterator/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)Dependencies (12)Versions (6)Used By (0)

Routes Directory Iterator
=========================

[](#routes-directory-iterator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/faa1176c33e376e19f9cb04b37fb47161081ad0a0c44a3442813e104daedd89f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746865616e6164696d756b742f726f757465732d6469722d6974657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theanadimukt/routes-dir-iterator)[![GitHub Tests Action Status](https://camo.githubusercontent.com/fdb346d7b60b7eef7711f0ce85512799de29909e2bd5596c28216e25dea349ad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f746865616e6164696d756b742f726f757465732d6469722d6974657261746f722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/theanadimukt/routes-dir-iterator/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/982ac2535d6494cba91fe46e93a2ef069c913a867d65c9db5c834f1a1fc351c0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f746865616e6164696d756b742f726f757465732d6469722d6974657261746f722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/theanadimukt/routes-dir-iterator/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/0cebb1d1741a7cca8a739f0a694efdaa04fbd8784b172a385d704cb5d0b69e18/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746865616e6164696d756b742f726f757465732d6469722d6974657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/theanadimukt/routes-dir-iterator)

This package contains a `RoutesDirIterator` facade class that you can use to register segregate routes from nested directories at one place.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require theanadimukt/routes-dir-iterator
```

Usage
-----

[](#usage)

For example, routes for admin and guest has written in seperate files in nested directory structure for clean code.

```
routes
├── admin
│   ├── posts.php
│   ├── routes.php
│   └── settings
│       ├── permissions.php
│       └── roles.php
├── guest
│   └── routes.php
└── web.php

```

posts.php - Add relevent routes to file

```
use Illuminate\Support\Facades\Route;

Route::get('/posts', function () {
    return view('admin.posts.index');
});
```

web.php - Use of package's `RoutesDirIterator` facade class.

```
use TheAnadimukt\RoutesDirIterator\Facades\RoutesDirIterator;
use Illuminate\Support\Facades\Route;

Route::middleware('auth')
    ->prefix('admin')
    ->name('admin.')
    ->group(function () {
        RoutesDirIterator::read(__DIR__ . "/admin");
    });

Route::middleware('guest')
    ->group(function () {
        RoutesDirIterator::read(__DIR__ . "/guest");
    });
```

Under the hood package will do the necessary work to register all segreagated routed and make it publishable.

List all published routes in using command

```
php artisan route:list
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Sagar](https://github.com/sagarpatel9697)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~0 days

Total

2

Last Release

1458d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d753ca4b86ebeb941eb707373de5cb95cb5dd49c5db16e5a049d41c3389abe5f?d=identicon)[theanadimukt](/maintainers/theanadimukt)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")[![theanadimukt](https://avatars.githubusercontent.com/u/25764632?v=4)](https://github.com/theanadimukt "theanadimukt (2 commits)")

---

Tags

laravelroutes-dir-iteratortheanadimukt

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/theanadimukt-routes-dir-iterator/health.svg)

```
[![Health](https://phpackages.com/badges/theanadimukt-routes-dir-iterator/health.svg)](https://phpackages.com/packages/theanadimukt-routes-dir-iterator)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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