How can I prevent editing vendor folder in Laravel?

How can I prevent editing vendor folder in Laravel?

0

If you have Settings/Preferences | Languages & Frameworks | PHP | Composer | Add packages as libraries, packages inside vendor should be marked as Library roots and be protected automatically.

You also can achieve that effect manually:

  1. Exclude the vendor directory at Settings/Prefrences | Directories.
  2. Add it to Settings/Preferences | Languages & Frameworks | PHP | PHP Include.
0
Avatar
Permanently deleted user

It only hides the files.
I want to see them but they will be protected from editing.

0

No. It notifies you that you are trying to edit the protected file.

Plus, such files have different background color, which you can change to make more obvious/standing out.

P.S. Try applying Read-Only attribute to them then (no ideas about Mac/Linux, but on Windows that works well).

0
Avatar
Permanently deleted user

For me, just excluding wasn't enough. Further confusingly, Windows (host machine) was showing the directory as read only. 

In my vm I recursively removed write access and that did the trick. 

```
chmod -w -R vendor

```

The name of the feature that you're looking for that creates a hard stop to editing protected files is: Non-Project Files Protection dialog

https://www.jetbrains.com/help/phpstorm/2020.2/non-project-files-access-dialog.html

0

After an upgrade (to 2024.1.2), this feature has not been working anymore. Repairing IDE did nothing except taking a lot of time.

The solution: go to Settings→PHP→composer→Add packages as libraries. Disable and enable again, apply, wait. 

Basic feature always broken after ervery update… No QA as it seems anymore, regressions all over the place…

0

请先登录再写评论。