How to publish API and broadcast route files in Laravel 11

Posted by

New projects will get a leaner skeleton as of Laravel 11. Some of the route files, which might be intimidating for inexperienced developers, have to be removed as part of the endeavour to make it happen.

That being said, as your application expands, you may need to build a RESTful API or, for an app that uses WebSockets, broadcast events into channels.

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
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x