How to split your Laravel routes into directories

How to split Laravel routes into directories or subfolders for more organisation and to keep the route files smaller.

In this example the Article API routes are placed into their own file in the api/ directory that has been created in the traditional routes/ directory.

In routes/api.php place:

require __DIR__ . '/api/article.php';

Now in routes/api/article.php you can have your Article API routes:

Route::middleware(['auth:api'])->group(function () {
    Route::get('/article', [ArticleController::class, 'index'])->name('api.article.index');
    Route::get('/article/{article}', [ArticleController::class, 'show'])->name('api.article.show');
    //etc
});