DEV Community

Cover image for Speed Up Your Laravel Website Super Fast- Codexashish
Ashish
Ashish

Posted on • Originally published at codexashish.com

Speed Up Your Laravel Website Super Fast- Codexashish

Speed Up Your Laravel website Super Fast

Laravel is the best back-end framework of PHP, and lots of companies are choosing Laravel for their large and medium-sized projects. SEO is incredibly important for each website. there are some tips you'll follow to create your laravel app super fast. So let's Start:-

1. Use Caching in production:

Each time you boot your laravel app , your app determines the middleware, resoles aliases, resolves route groups, and identifies the controller action and parameter inputs for each single route entry. so you'll be able to think how bad it's for your app within the production.

You can bypass route processing by caching all routes running this so.:-

php artisan route:cache

What about configuration caching ?? to bypass parsing your .env and config files on every app boot you must run:-

php artisan config:cache

use config() to access .env variables , avoid using env()

you must not compile your views whenever, just use pre-compiled blade template views, to try and do that run this command.

php artisan view:cache

**To cache a manifest of all of your app's events and listeners

run :**

php artisan event:clear

_Recreate boostrap/cache/compiled.php _

php artisan optimize

Alert :

You need to clear the cache to reflect any new changes by using the commands:

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

2. Remove Dev dependencies from the composer

When you develop your project likely you may be using some Dev packages to trace queries or other development things, remove those packages that aren't required within the production.

So just run one command within the production and then.:

composer install --prefer-dist --no-dev -o

Click Here to read more

Thankyou
Codexashish

Top comments (0)