The conflict
key in a Composer composer.json
The conflict
key in a Composer composer.json
file is used to declare packages that your project cannot work with. It’s a way to prevent the installation of certain versions of packages that you know would cause problems with your project.
Example:
"conflict": {
"cocur/slugify": "4.5.0"
}
This configuration means that your project cannot be installed or updated if the version 4.5.0 of the cocur/slugify
package is also required. If another dependency in your project requires cocur/slugify
version 4.5.0, or if you try to require that version directly, Composer will throw a conflict error and prevent the installation or update.
The conflict
key is useful when you know that a particular version of a package has a bug or a breaking change that affects your project, and you want to ensure that Composer does not install that version.
In summary, this configuration tells Composer: “My project cannot work with version 4.5.0 of the cocur/slugify
package, so please do not install that version.”