Skip to content
This repository has been archived by the owner on Jan 16, 2020. It is now read-only.

Add composer template #15

Merged
merged 12 commits into from
Nov 7, 2017
Merged

Add composer template #15

merged 12 commits into from
Nov 7, 2017

Conversation

geerteltink
Copy link
Member

As discussed in several communication channels, there is no clear path on how the composer.json file should look like these days. There have been many changes which were not communicated to all maintainers and contributors in a central place. This PR adds a composer.json template to provide that central communication to everyone involved.

@froschdesign
Copy link
Member

@xtreamwayz
You are too fast! 😉
I had already written a new issue report, but your PR is much better!

"type": "library",
"license": "BSD-3-Clause",
"keywords": [
"http",
Copy link
Member

@froschdesign froschdesign Jul 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace these lines with a short description like:

"keywords" : [
    "<individual keywords for current project>"
],

}
},
"require": {
"php": "^5.6 || ^7.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change order also here, to have first 7.0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know. I think in every project it's the lowest PHP first at the moment.

"issues": "https://github.com/zendframework/<project-name>/issues",
"source": "https://github.com/zendframework/<project-name>",
"slack": "https://zendframework-slack.herokuapp.com",
"forum": "https://discourse.zendframework.com"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we have here link to the main page of forum or maybe specific category there?
https://github.com/zendframework/zend-expressive/blob/master/composer.json#L19

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a category exists, then we should use it.

"type": "library",
"license": "BSD-3-Clause",
"keywords": [
"http",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have here also zf or zendframework keyword?

"test": "phpunit --colors=always",
"test-coverage": "phpunit --coverage-clover clover.xml"
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add empty line at the end of the file.

"php": "^5.6 || ^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would update these version to the latest: ^6.2.3 || ^5.7.21

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, however PHP Unit updates twice a month or so. It should not be the goal of this template to keep track of PHP Unit releases.

"type": "library",
"license": "BSD-3-Clause",
"keywords": [
"<individual keywords for current project>"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have here some common keywords like zf or zendframework?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. The keywords are used at searching and filtering. Maybe is "zend" as mark / brand also interesting?!

@@ -0,0 +1,55 @@
{
"name": "zendframework/<project-name>",
"description": "<project-description>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion:

"description": "<project description, the same like the repository description>",

- Add default keywords
- Add possible forum categories
- Update PHP Unit versions
- Add empty line at end of file
- Update description
> It is recommended to omit this field and have it just default to
> `library`.

@see https://getcomposer.org/doc/04-schema.md#type
@@ -2,7 +2,6 @@
"name": "zendframework/<project-name>",
"description": "<project description, the same like the repository description>",
"homepage": "https://docs.zendframework.com/<project-name>/",
"type": "library",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 👍

@michalbundyra
Copy link
Member

@xtreamwayz what about adding:

"config": {
  "sort-packages": true
},

https://github.com/weierophinney/hal/blob/master/composer.json#L15-L17

@geerteltink
Copy link
Member Author

I was thinking about sort-packages as well. I'm not sure how that works out with existing dependencies. It's added to the expressive skeleton as well. It does make it easier to lookup dependencies when they are sorted.

@geerteltink
Copy link
Member Author

Currently version constrains are written in different ways:

  • "^5.6 || ^7.0"
  • "^6.2 || ^5.7",
  • "^1.0 || 1.0.x-dev".

According to the composer docs it doesn't matter how you write it?

When you write a version constraint, it may reference a specific tag (e.g., 1.1) or it may reference a valid range of tags (e.g., >=1.1 <2.0, or ~4.0). To resolve these constraints, Composer first asks the VCS to list all available tags, then creates an internal list of available versions based on these tags. In the above example, composer's internal list includes versions 1.0, 1.0.1, 1.0.2, the beta release of 1.1, the first and second release candidates of 1.1, the final release version 1.1, etc....

When Composer has a complete list of available versions from your VCS, it then finds the highest version that matches all version constraints in your project.

So what to do? "lowest || highest" vs "highest || lowest".

@froschdesign
Copy link
Member

froschdesign commented Jul 15, 2017

…it doesn't matter how you write it?

Right, because:

…finds the highest version…

I prefer a simple and intuitive reading: "lowest || highest"

@weierophinney
Copy link
Member

I assumed that the || operator worked as it does in most programming languages, choosing the first to match. However, when I consider it from a practical point of view, it will use this to determine what set of packages are valid, so it can choose the latest based on the requirements of other dependencies.

So, the main thing is that we are consistent. I agree with @froschdesign that latest last makes sense, as the constraints are then ordered.

@froschdesign
Copy link
Member

LGTM 👍

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the template is for new packages, we should push the PHP and PHPUnit constraints higher.

All else looks good.

"docs": "https://docs.zendframework.com/<package_name>/",
"issues": "https://github.com/zendframework/<package_name>/issues",
"source": "https://github.com/zendframework/<package_name>",
"rss": "https://github.com/zendframework/<package_name>/releases.atom",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it funny that we use an Atom feed for the RSS item. 😄 That said, it's the only appropriate location.

"forum": "https://discourse.zendframework.com/c/questions/<components|expressive|apigility>"
},
"require": {
"php": "^5.6 || ^7.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new packages, this will be simply ^7.1, in which case, we can change the PHPUnit constraint to simply ^6.2.

@weierophinney weierophinney merged commit dbfae78 into zendframework:master Nov 7, 2017
weierophinney added a commit that referenced this pull request Nov 7, 2017
weierophinney added a commit that referenced this pull request Nov 7, 2017
@weierophinney
Copy link
Member

Thanks, @webimpress!

@geerteltink geerteltink deleted the feature/composer-template branch November 8, 2017 04:03
@geerteltink
Copy link
Member Author

Thanks, @webimpress!

???

@michalbundyra
Copy link
Member

lol, thanks @xtreamwayz 👍 👍 👍

@weierophinney
Copy link
Member

@xtreamwayz I typed the wrong issue identifier when I wrote that! (I use gh from the command line for a number of tasks)

THANK YOU, Geert!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants