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
alexmorning

Mar 30th, 2024 12:18 AM

Hi, I was just wondering the reason for putting the vendor folder in .gitgnore...because at least for my own configuration, it means that I have to composer install each thing again on my server after I have it installed on my local.

I was just doing it this way because I thought maybe there is a good purpose for it, but I am just wondering what the purpose is and if it would cause any problems if I removed this from .gitignore?

Thank you!

thinkverse

Mar 30th, 2024 08:44 AM

It's mostly ignored to reduce the repository size. vendor, node_modules and directories like those that hold dependencies are usually larger locally than on your production server.

Locally when developing the application you'll also have development-specific dependencies in those directories that you don't want in production as well. Keep in mind too that these directories change quite often during development. More than they do on production.

There might be dependencies in these directories that you cannot commit to storage - packages you bought or subscribed too for instance, it's highly likely those have contracts or terms that forbid them from being committed to version control.

Some applications and projects differ from the norm and do commit these to version control. In the end it's up to you, your team and your situation.

Report
2
bobbyiliev

Mar 31st, 2024 03:21 AM

Best Answer

Hello Alex,

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

Report
1
alexmorning

Apr 30th, 2024 01:31 AM

That is really helpful, thank you very much. I hadn't thought about the conflicts that could happen. it's not too terrible of a hassle, so if you say it's better/safer to keep it ignored and manually do it on my local/remote separately then I will do that.

thank you for the informative replies (bobby & thinkverse)

Report
1