Reducing size of Yii template app

Hi all

I was uploading my new Yii2 application and was surprised that it took 20minutes. So I checked the app-folder and found out that the Basic application has cca 6300 files and cca 65MB. See attachment (img created using Space Monger)

  • Is there a way how to reduce the size?

  • It would be nice if the debug-mode had a tool that would analyze used modules and would suggest folders that can be deleted.

I believe that answer could be added to tutorial:

http://www.yiiframework.com/doc-2.0/guide-tutorial-performance-tuning.html

Thanks for ideas.

run composer install with a flag --no-dev to skip the development dependencies when deploying, read more about composer to understand it. It will reduce your app size

If you have ssh/cmd-line access to your server, you usually don’t copy ‘vendor’. You just run composer :)

There, you can use the --no-dev flag.

Also, a good idea to use --optimize-autoloader too!

1 Like