Home > Software design >  Should Laravel's "vendor/bin" be in the system's PATH?
Should Laravel's "vendor/bin" be in the system's PATH?

Time:03-25

I'm trying to follow this series of guides for deploying my Laravel app using the open-source deployer tool.

The guide is generally very good, but the linked step is confusing - it says to install the deployer package using something like:

composer require deployer/deployer

...and that this should make the dep binary available globally - but not only does this not happen on my system (Cygwin, which is technically Windows but emulates POSIX systems pretty closely), I wouldn't expect it to either since the project's vendor/bin isn't in my PATH, and I wouldn't expect to have to place project-specific vendor/bin folders into the PATH because this would be needed for every Laravel project I had, potentially resulting in tens of thousands of binaries in the PATH.

Is this actually the intended way to do this, or is there a more natural/scalable way that is also guaranteed not to break anything? Would simply installing the dep binary manually to /usr/local/bin cause problems with how deployer runs, either locally or on my server?

CodePudding user response:

Should Laravel /vendor/bin be in the PATH?

No, a composer's project (Laravel or any other) vendor/bin should not be generally added to the system's path.

Is this actually the intended way to do this, or is there a more natural/scalable way that is also guaranteed not to break anything? Would simply installing the dep binary manually to /usr/local/bin cause problems with how deployer runs, either locally or on my server?

Usually a utility like this would be installed globally, not per-project. So either you install it like composer require deployer/deployer --global, or you download the "binary" (PHAR file in this case) and put it somewhere within your system's path.

  • Related