PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Blocks

    Design blocks for your website

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Question By
Solved

Vender folder in .gitignore

Solved
1004reg

Apr 24th, 2024 12:33 AM

Hi there, I'm curious about the reason for including the vendor folder in .gitignore. For my setup, this means that I have to run composer install again on my server after already installing everything locally.

I assumed there might be a good reason for this practice, but I'd like to understand the purpose behind it and whether removing it from .gitignore would cause any issues.

Thanks for any insights!

bobbyiliev

Apr 24th, 2024 12:44 AM

Best Answer

Hey!

Interestingly enough, we just had this exact question a couple of weeks ago:

Vender folder in .gitignore

Including the vendor folder in your .gitignore is standard practice in the PHP world, especially when you're using Composer. This is also valid for almost all other languages like JS with npm, yarn and the node_modules directory for exmaple.

Essentially, the vendor folder can get hefty. Excluding it keeps your repository lightweight and speedy to clone.

Also, dependencies update frequently. Tracking these changes in version control can lead to unnecessary merge conflicts all of the time.

By running composer install in each environment, you're making sure that everyone, from development to production, is on the same page, dependency-wise.

Running composer install on your server—consider it a small price for maintaining a clean and consistent workflow. If it's a hassle, you might want to explore optimizing your deployment process, perhaps with CI/CD pipelines, to streamline this step.

In essence, while it might seem tempting to track vendor, resisting the urge keeps your project clean, consistent, and in harmony with Composer's ecosystem.