Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jarmark's avatar

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

0 likes
15 replies
primordial's avatar

@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.

jarmark's avatar

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"
    }
}
richard's avatar

Hmm that's weird.

What is the size of this?

composer create-project laravel/laravel newblog "5.3.*"
jarmark's avatar

@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.

martinbean's avatar

My vendor folder in a Laravel 5.3 application is only ~45 MB :-/

jarmark's avatar

In my project libraries in vendor folder contain unit tests, so it may be something wrong with git.

ohffs's avatar

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...

1 like
Hendriksie's avatar

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 :)

jarmark's avatar

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?

ejdelmonico's avatar

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.

1 like
jarmark's avatar

I have reinstalled git and composer and deleted temp folders in %appdata%. Now my project has about 40 MB with vendors.

rodo's avatar

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.

jlrdw's avatar

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.

Please or to participate in this conversation.