Get your next remote job on LaraJobs.

How to publish API and broadcast route files in Laravel 11

Benjamin Crozat
Published on Feb 23, 2024 0 comments Edit on GitHub
How to publish API and broadcast route files 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.

Wait, there's more!

Be the first to comment!

Get help or share something of value with other readers!

Great deals for enterprise developers
  • Summarize and talk to YouTube videos. Bypass ads, sponsors, chit-chat, and get to the point.
    Try Nobinge →
  • Monitor the health of your apps: downtimes, certificates, broken links, and more.
    20% off the first 3 months using the promo code CROZAT.
    Try Oh Dear for free
  • Keep the customers coming; monitor your Google rankings.
    30% off your first month using the promo code WELCOME30
    Try Wincher for free →
The latest community links
- / -