Is there any limit in composer for the major version number in a package?

Viewed 49

I have some PHP projects that use a private library that is not published in packagist. This library dependency is managed using a vcs repository declared in composer.json file.

I have been using semantic versioning but, as we are moving to periodic releases in time we are trying to switch to a calendar versioning like that:

YYYY0M.MINOR.MICRO

I created the right tag in the library's git repository (for example v202207.1.0) and pushed it to the repository but composer is not able to found it.

If I declare the dependency with tilde:

"private/dependency": "~202207.1.0",

I have this error message:

Problem 1
    - Root composer.json requires private/dependency ~202207.1.0, found private/dependency[v1.52.0, ..., v1.66.68, v2.0.0, ..., v2.9.10] but it does not match the constraint.

If I remove tilde and link the dependency to a concrete version :

"private/dependency": "202207.1.0",

I receive this message:

Could not parse version constraint 202207.1.0: Invalid version string "202207.1.0"  

Reviewing composer documentation it seems that it is developed with only semantic versioning in mind, but, although I'm using a calendar version number for the first number of my private package (major) it is still an integer.

Is there any limit in composer for the "major" version of a library?. I read the semantic versioning manifest and the specs didn't set any limit to the first value. I also read composer documentation and I didn't found any restriction in it.

I tried to tag my package with YY0M.MAJOR.MICRO and composer works ok and founds the right dependency in the VCS repository so it makes me think that there is any restriction.

0 Answers
Related