php-pds / skeleton

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

Use Composer's provide instead of require-dev #14

Closed ravage84 closed 7 years ago

ravage84 commented 7 years ago

I wanted to bring up a really good blog post comment on your blog post about this standard:

Fabian 2016-12-16 at 05:55 I really like that small standard. I suggest putting it into “provide” (https://getcomposer.org/doc/04-schema.md#provide) instead of “require-dev”, so you can track formal adoption (e.g. https://packagist.org/providers/psr/log-implementation)?

Totally agree, as it would be "semantically incorrect" to require(-dev) the standard, but "semantically correct" to use the provide key.

https://getcomposer.org/doc/04-schema.md#provide

Not sure how one could query the Packagist API on that, though...

pmjones commented 7 years ago

It is indeed a good blog post comment; I need to answer it there as well.

My first thought is that "provides" says that a package "makes X available", not that a package "uses X". (I may be wrong about that, and need to read the schema more closely.)

My second thought is something that I've only spoken publicly about on https://voicesoftheelephpant.com/2016/12/20/interview-paul-m-jones/ . It is that by require-dev-ing the standard in your package, the standard can do two things:

  1. Deliver the standards document into the package, for reference by developers as they work on the package.

  2. Possibly also deliver some code related to the standard. In the case of pds/skeleton, that might mean a validation script, or a skeleton-generator script. But I would want to think more carefully about this one.

Hope that makes sense.

ravage84 commented 7 years ago

Why not using Composer's create-project?

https://getcomposer.org/doc/03-cli.md#create-project

It's exactly made for that purpose. Once a directory structure is created for a package, one will never use such a script again.

So, requiring it, even just as development dependency, does not make much sense for a package developer. Thus, provide does the job.

pmjones commented 7 years ago

Why not using Composer's create-project?

Off the cuff, one reason is that it would apply only to new projects, whereas there are many existing packages now that are at least tentatively compliant with the standard. These existing projects can add a package-manifest entry pretty easily to advertise acceptance; e.g., with Composer, it's a require-dev entry.

Further, I expect there to be other PDS publications. One will not "create-project" with them all individually.