How to publish API and broadcasting routes in Laravel 11
Starting from Laravel 11, new projects get to experience a slimmer skeleton. Parts of the efforts to make it happen was to remove some of the route files which can be overwhelming for new developers.
That being said, as your application grows, you might need to create a RESTful API or broadcast events into channels for an app leveraging WebSockets.
To publish the API routes file in Laravel 11 and up, use:
php artisan install:api
This command will create the routes/api.php file, but also install Laravel Sanctum, create some migrations, and add a config/sanctum.php file.
And to publish the broadcasting channels routes file, use:
php artisan install:broadcasting
After running the command, Artisan will also ask you if you want to install Laravel Reverb.