php-pds / skeleton

Standard PHP package skeleton.
Creative Commons Attribution Share Alike 4.0 International
2.32k stars 167 forks source link

Question: Clarify "resources" vs "vendor" in composer projects. #47

Open yeboahnanaosei opened 6 years ago

yeboahnanaosei commented 6 years ago

First of I want to say thanks for this work!

I'm still relatively a beginner developer. From reading this standard it appears to me that a "resources" directory is analogous to a "vendor" directory in a composer project. (I could be completely wrong)

Considering the relative popularity of composer in PHP projects, how does this standard reconcile the two? Should the "vendor" directory substitute the "resources" directory in a composer project?

Can the two folders be seen as conceptually being the same?

samwilson commented 6 years ago

I have always thought that "other resource files" meant assets such as CSS, JS, images, etc. whereas vendor/ is always for packages.

It's certainly odd that there's no mention of vendor/ in the docs here; this should be fixed I reckon.

odan commented 6 years ago

/vendor is definitely reserved for a package manager like composer.

Here is the "removed" text from the specification:

The vendor/ directory MUST be reserved for use by package managers (e.g.: Composer).

If the repository type is designated as a "project" in its composer.json file, the vendor/ directory SHOULD be ignored by revision control tools (e.g.: Git, Mercurial, Subversion, etc.). It SHOULD NOT be committed to revision control repositories.

If the repository type is designated as a "library" (the default) or otherwise in its composer.json file, the vendor/ directory MUST be ignored by revision control tools (e.g.: Git, Mercurial, Subversion, etc.). It MUST NOT be committed to revision control repositories.

This publication does not otherwise define the structure and contents of the directory.

The reason for removing this section was that you should never commit the vendor/ directory to your git repository. Therefore the directory vendor/ is not part of this specification. Read more: #19

resources/ is the directory where people can store assets (actually, anything that is not PHP code). For example: umcompiled assets (js, css), sass, scss, fonts, locals and so on. Read more: #12