4

Is it possible to configure PHP Composer to use a ~ prefix to constrain dependencies to patch-level updates (like 1.2.x) instead of the default ^ (1.x.x)?

The term used in their documentation is "Next Significant Release Operators," but I don't see any related options in their config

(NPM has similar behavior but you can configure it in your .npmrc file with save-prefix=~. My rationale is that our build system can't trust every package author to use semantic versioning correctly, or at all.

DMack
  • 871
  • 2
  • 9
  • 21
  • How are you adding your requires? If you specify a version using `~` (e.g. `composer require foo/bar ~1.2`) your `composer.json` file should reflect that same constraint. – ChrisGPT was on strike Oct 27 '16 at 19:11
  • I meant if I just say composer require some/package and press enter to use the latest version, it will update composer.json with ^latest by default. Maybe it's not the typical use case, but I rarely know what the latest version of a package is when I pull it in, so I almost always just hit enter to use the latest. – DMack Oct 27 '16 at 20:21

0 Answers0