Laravel - How to clear cache

Laravel - How to clear cache

T

Theodoros Kafantaris

Published on June 05, 2024

One Command Clear all Cache

It clears all the cached data that Laravel may have generated to optimize performance. This includes clearing the application cache, route cache, configuration cache, compiled views, and other cached data.

Code
                    php artisan optimize:clear
                


Output:


Clear Application Cache

It removes all items from the default cache store used by the application. This can include data cached from database queries, API calls, and other operations that have been cached to improve performance.

Code
                    php artisan cache:clear


                


Output:


Clear Configuration Cache

This command will invalidate the cached configuration, ensuring that any changes to the configuration files are applied.

Code
                    php artisan config:cache
                


Output:


Clear Route Cache

This command will clear the cached routes. This is important when new routes are added or existing routes are modified.

Code
                    php artisan route:cache
                


Output:


Clear View Cache

This command also clears compiled Blade views, ensuring that any changes to view files are reflected the next time the views are rendered.

Code
                    php artisan view:clear
                


Output:

About Our Blog

Discover insights, tutorials, and best practices in software development. Our team shares practical knowledge and cutting-edge techniques to help developers build better applications.

Ⓒ 2025. All rights reserved by atomic