@Jarmark Not really but If it helps the vendor folder should not be under revision control. When you deploy to your live server you run "composer install" from project root at the command line to recreate the vendor folder.
Laravel 5.3 project size is very big
I have installed Laravel using command composer create-project --prefer-dist laravel/laravel blog. Vendor folder has about 200 MB.
Is it any possibility to reduce project size?
Best regards, jarmark
I ran composer install inside empty project and still have ~200 MB.
This is my composer.json file.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"php artisan optimize"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
Hmm that's weird.
What is the size of this?
composer create-project laravel/laravel newblog "5.3.*"
@richard Still about ~200 MB
This time It was not possible to install Laravel 5.3 without having git. Without it I had got errors during Laravel installation via composer.
When the installation goes to an end composer asks whether I want to remove the existing VCS files (.git and .svn). I typed yes (Y).
I remember when I was installing Laravel 5.2 I didn't need git to do it. I currently work on Windows 7. Maybe it will be a little clue.
My vendor folder in a Laravel 5.3 application is only ~45 MB :-/
In my project libraries in vendor folder contain unit tests, so it may be something wrong with git.
If you run `find vendor | egrep '.git' are there a lot of git folders? Afair depending how composer runs it'll pull down the whole git repo.
I actually just noticed that on a project I deployed - the local dev copy is ~45mb and the deployed one is ~150mb due to git. Now to try and remember what causes it...
This is what I get https://justpaste.it/10zy2
A lot of entries with .git
My newly installed Laravel 5.3 vendor folder is only 25MB.
Laravel itself without vendor and node_modules is less than 4MB.
My node_modules folder is over 120MB though :)
Ok, but going to conclusion what I do wrong when type composer create-project --prefer-dist laravel/laravel blog
How can I reduce vendor size for production?
Use yarn instead of npm to minimize node_modules directory size. I get no where near the new project size you are getting. Most of my vendor directories are 25 to 40mb in size.
The largest project I have is 220MB and that is with Laravel 5.3, Spark 3.0.4 and Cashier that is included with Spark.
I have reinstalled git and composer and deleted temp folders in %appdata%. Now my project has about 40 MB with vendors.
my project CakePHP has about 14MB and my project Laravel 34MB in skeleton format. ¿Why are so much diferent in size? Laravel installs thing like aws/aws-sdk-php, doctrine/couchdb, ext-mong, league/flysystem-rackspace, etc. what may never need.
Newbees wanted more and more. I still think level 4.2 is so much better than newer versions for a regular database management system that don't need all the frills. When they want more and more it does not dawn on them the size of that vendor folder needs more and more.
Found a really nice and strayghtforward solution to my 500Mb vendor folder problem. It was due to missing php zip packages. Install php zip(for me Debian php7.1): ( https://stackoverflow.com/questions/41274829/php-error-the-zip-extension-and-unzip-command-are-both-missing-skipping )
apt-get install --yes zip unzip php-pclzip
Remove vendor folder
rm -rf vendor
And reinstall packages
composer install
Please or to participate in this conversation.