Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cactus18's avatar

Routes not showing

php artisan route:list is not listing the routes that I have created. I have tried php artisan route:clear, php artisan view:clear, php artisan config:clear, php artisan route:cache, php artisan optimize to make sure everything is clear. Have also tried composer dump-autoload .

This is my routes/api.php file. The /welcome and /debug routes are to debug, but even those are not showing up.

<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\Api\ProductController;
use App\Http\Controllers\Api\TransactionController;

Route::get('/user', function (Request $request) {
    return $request->user();
})->middleware('auth:sanctum');

Route::view('/welcome', 'welcome');
Route::get('/debug', function (Request $request) {
    return 'Debugging!';
});

Route::apiResource('products', ProductController::class);
Route::apiResource('products.transactions', TransactionController::class);
0 likes
4 replies
tykus's avatar

Is the api.php file being used for Routing at all? What does the withRouting part of the Application bootstrapping look like; is the api named parameter getting a value like below?

    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php', // is this line included
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
cactus18's avatar

that fixed it! thank you so much! this is my first Laravel project and I was about to quit

tykus's avatar

@cactus18 no worries; please mark the thread solved if you're all set. Best of luck with your journey

Please or to participate in this conversation.