Get in Touch With Us

Submitting the form below will ensure a prompt response from us.

Laravel provides an easy way to manage and clear cache, including route cache, to ensure your application works efficiently. Below are the commands and steps for clearing route cache in Laravel:

Clear Route Cache in Laravel

Clear Route Cache via Artisan Command:

You can use the following Artisan command to clear the route cache:

php artisan route:clear

This command clears the cached routes file, ensuring Laravel re-parses the route definitions.

Clear All Cache (Including Route Cache):

If you want to clear all cache types, including route cache, you can run:

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear

Rebuild Route Cache:

After clearing, you might want to rebuild the route cache for better performance:

php artisan route:cache

Note: This command caches your routes in a single file for optimized performance. Avoid using it during development.

Important Considerations:

  1. Always clear and rebuild the route cache after making changes to your routes/web.php or routes/api.php files.
  2. Avoid caching routes during active development, as changes might not reflect without clearing the cache.
  3. Regularly clear cache in production environments after deployments to prevent stale data.
About Author

Jayanti Katariya is the CEO of Moon Technolabs, a fast-growing IT solutions provider, with 18+ years of experience in the industry. Passionate about developing creative apps from a young age, he pursued an engineering degree to further this interest. Under his leadership, Moon Technolabs has helped numerous brands establish their online presence and he has also launched an invoicing software that assists businesses to streamline their financial operations.

Related Q&A