Some Artisan Commands to Speed Up Laravel Application

Hello artisan 

In this example i am going to discuss about some artisan command whose are ready to optimise and increase your Laravel website speed. So if you don't know the process of how to increase website speed in laravel then follow this step by step tutorial. Hope it will help you to increase your Laravel website speed and of course you have learnt the way of how to speed up Laravel application.

You know that speed is very important thing for a web application. It is important for our seo and it will increase also website user experience. User feel better to visit website from search engine which website speed is good. Google also recommend that website speed is helpful to increase traffic. So we should always try to increase our website speed to get better user experiences.

In this Laravel laravel performance optimization tutorial i am going to use some Laravel artisan command like laravel clear cache, laravel cache clear, clear cache laravel, laravel config clear, laravel route cache etc.

Do you know that Laravel application serves the cached data so caching problem occurs due to the robust cache mechanism of Laravel Let's start our how to increase website speed in laravel tutorial. 

Clear Route Cache in Laravel

Removing route cache in Laravel just use the given below command:

php artisan route:cache

 

Clear Application Cache in Laravel

Run the following command to clear laravel application cache:

php artisan cache:clear

 

Clear Config Cache in Laravel

You have run the following command to clear config cache:

php artisan config:cache

 

Clear View Cache in Laravel

Run the following below command to clean your view cache:

php artisan view:clear

 

Reoptimize Class

Run the below command to reoptimize the class loader:

php artisan optimize

 

You can run all the command using artisan call. Check the below code to understand:

// Remove route cache
Route::get('/clear-route-cache', function() {
    $exitCode = Artisan::call('route:cache');
    return 'success';
});

//Remove config cache
Route::get('/clear-config-cache', function() {
    $exitCode = Artisan::call('config:cache');
    return 'success';
}); 

// Remove application cache
Route::get('/clear-app-cache', function() {
    $exitCode = Artisan::call('cache:clear');
    return 'success';
});

// Remove view cache
Route::get('/clear-view-cache', function() {
    $exitCode = Artisan::call('view:clear');
    return 'success';
});

 

Read also: Process to Generate Unique Slug Example in Laravel

 

Hope it can help you to increase you laravel website speed.

 

author-image
Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js