Optimize Laravel website Opening speed

Source: Internet
Author: User

Laravel is a powerful framework, many components, code is also very large, its ease of use is sacrificing performance, even though it is still an excellent framework, but in the formal environment to optimize the speed of the site to improve.

1. Turn off debug

Open the. env file and set debug to False.

app_env=Localapp_debug=falseApp_key=base64:st/atfeae13eyao1raee6jc9ff+yle1se+ wtyk0h6b4=

2. Cache Routing and Configuration

PHP Artisan route:cachephp Artisan Config:cache

3.Laravel optimization Command

PHP Artisan Optimize

4.composer optimization

sudo composer Dump-autoload optimize

5. Using the Laravel cache

Using the Laravel cache method caches content, comes with file cache, database cache, Redis cache, or can be combined with Predis components or multiple caches using Redis. It is so elegant and convenient to use in Laravel:

$lists = Cache::remember ('travel.destination.lists', function () {     return $this->destination->getList ();});

6. Using CDN

This site is seven cattle CDN, send you a monthly 20G traffic and 20G storage space, how much do not remember, in short, for a small station is completely enough.

Http://blog.tanteng.me/2016/06/laravel-optimize/?utm_source=tuicool&utm_medium=referral

Optimize Laravel website Opening speed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.