composer require latte/latte problem

vyatka
Member | 2
+
0
-

Hello, everybody. It's my first time for test Nette as packages
Nowaday I play with forms, thanks for examples in repo.
I have such composer.json file:

{
    "name": "sergey/nette-contact",
    "description": "Conntact form for tests",
    "type": "project",
    "require": {
        "tracy/tracy": "v3.0.x-dev",
        "nette/forms": "v3.1.x-dev",
        "nette/utils": "v3.2.x-dev"

    },
    "authors": [
        {
            "name": "Sergey Mo"
        }
    ],
    "minimum-stability": "dev",
    "scripts": {
        "serve": "php -S localhost:11000"
    }
}

and if I try to add latte with composer require latte/latte I get “Installation failed” :

composer require latte/latte
Using version 3.0.x-dev for latte/latte
./composer.json has been updated
Running composer update latte/latte
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - nette/forms is locked to version v3.1.x-dev and an update of this package was not requested.
    - nette/forms v3.1.x-dev conflicts with latte/latte 3.0.x-dev.
    - Root composer.json requires latte/latte 3.0.x-dev -> satisfiable by latte/latte[3.0.x-dev (alias of dev-master)].


Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Why is so? And what is the right way to add Latte as dependency.

nightfish
Member | 517
+
0
-

@vyatka Hello, the problem is that your composer.json configuration is forcing composer to try to install newest dev-version of latte, which is latte/latte:3.0.x-dev – and this one is incompatible with already installed package nette/forms:v3.1.x-dev. When you look at packagist, you can see that nette/forms in this version _conflicts with_ latte/latte: >=3.0, meaning you will have to install latte/latte in version older than 3.0.

There are two approaches you can try:

  1. add "prefer-stable": true to your composer.json (this should, in theory, try to install last stable release of latte/latte, which is v2.10.3)

or

  1. specify latte version composer command: composer require latte/latte:^2
vyatka
Member | 2
+
0
-

@nightfish thanks man for explanation.Specified version and it's work.