Repository: composer/satis

Issue #529: Unable to resolve virtual package with providers = true options
Created: 2019-03-05T11:19:47Z
Composer is unable to resolve packages mirrored by generated Satis repository.
Installation works as expected without satis-repository in composer.json or if repository is built without "providers": true option.
Reproduction steps:
run satis build with satis.json:
{
    "name": "Repository",
    "homepage": "http://localhost:4170",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        }
    ],
    "require": {
        "fig/http-message-util": "1.1.3",
        "psr/container": "1.0.0",
        "psr/http-factory": "1.0.0",
        "psr/http-message": "1.0.1",
        "psr/http-server-handler": "1.0.1",
        "psr/http-server-middleware": "1.0.1",
        "zendframework/zend-diactoros": "2.1.1",
        "zendframework/zend-escaper": "2.6.0",
        "zendframework/zend-expressive": "3.2.1",
        "zendframework/zend-expressive-router": "3.1.0",
        "zendframework/zend-expressive-template": "2.0.0",
        "zendframework/zend-httphandlerrunner": "1.1.0",
        "zendframework/zend-stratigility": "3.1.0"
    },
    "providers": true,
    "output-dir": "./packages",
    "archive": {
        "directory": "dist",
        "format": "zip",
        "prefix-url": "http://localhost:4170",
        "skip-dev": true
    }
}
Create empty folder with composer.json:
{
    "name": "example/template",
    "description": "Package description",
    "type": "project",
    "license": "MIT",
    "repositories": [
        {
            "type": "composer",
            "url": "http://localhost:4170/"
        }, {
            "packagist": false
        }
    ],
    "require": {
        "zendframework/zend-diactoros": "^2.0",
        "zendframework/zend-expressive": "^3.2"
    },
    "config": {
        "secure-http": false,
        "sort-packages": true,
        "preferred-install": {
            "*": "dist"
        }
    }
}
Run composer update -vvv.
Output:
Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:\Users\Username\AppData\Local\Temp\ope25BA.tmp: valid
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): git branch --no-color --no-abbrev -v
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): git describe --exact-match --tags
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): git log --pretty="%H" -n1 HEAD
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): hg branch
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): fossil branch list
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): fossil tag list
Executing command (C:\Users\Username\PhpstormProjects\Nutshell\test): svn info --xml
Failed to initialize global composer: Composer could not find the config file: C:/Users/Username/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Running 1.8.4 (2019-02-11 10:52:10) with PHP 7.3.2 on Windows NT / 10.0
Loading composer repositories with package information
Downloading http://localhost:4170/packages.json
Warning: Accessing localhost over http which is an insecure protocol.
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/packages.json into cache
Updating dependencies (including require-dev)
Downloading http://localhost:4170/p/zendframework/zend-diactoros%24980144f5ac6179b95be0c0d4f131ff6d16f32e44b003f71c5f4ffc3c3a08d2fa.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-diactoros.json into cache
Downloading http://localhost:4170/p/psr/http-factory%24be6ea9dd41ac07068c080bea7d7168bc3bdf1ac618ff8d2c338765d3bf70f8e3.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-factory.json into cache
Downloading http://localhost:4170/p/psr/http-message%242e8eba2185113b23985e96e7aec692e054f3f426b81d01684f3867408fee5a36.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-message.json into cache
Downloading http://localhost:4170/p/zendframework/zend-expressive%243769d281a8dc8560e5fbf7a1dfd3bdd01d75617b7c4a7bc3108b2b0205955e20.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-expressive.json into cache
Downloading http://localhost:4170/p/fig/http-message-util%2423fc9131b8a1c11fd90985fb19c0d4501ba43b5083cb38cc59389ef1cfebefcc.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-fig$http-message-util.json into cache
Downloading http://localhost:4170/p/psr/container%24777c77a8ba52ffbbafa2061af6a3dfb398efcc62360ad360d6dd991f35d9b630.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$container.json into cache
Downloading http://localhost:4170/p/psr/http-server-middleware%244fd8218c74dc8cdef426b7791d05e06bdb9638e7c18713c2ad36c6f958771900.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-server-middleware.json into cache
Downloading http://localhost:4170/p/zendframework/zend-expressive-router%24e0ee02cf76d00edfeede259b944cbac4b914ebe23f1e8bae32a6f395c2458052.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-expressive-router.json into cache
Downloading http://localhost:4170/p/zendframework/zend-expressive-template%242ec817460c71c46051bd0adb16970909223aaf235b01342cd538216cab8e96de.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-expressive-template.json into cache
Downloading http://localhost:4170/p/zendframework/zend-httphandlerrunner%24cf8ee39542dd7c4813bf460ebee1c2ebebda736b972a08bf18ca4fc945d59647.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-httphandlerrunner.json into cache
Downloading http://localhost:4170/p/zendframework/zend-stratigility%24f46b3ae6377f37a6a70a38701cdf990a99856845951517d9e86fdac7e0573c01.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-stratigility.json into cache
Downloading http://localhost:4170/p/psr/http-server-handler%24f73d6452ec6d02f86534fcad2fc51b3baf390bf107ddd277430ff344180ce041.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-psr$http-server-handler.json into cache
Downloading http://localhost:4170/p/zendframework/zend-escaper%241e7ade65f12923e6e64f14af11f3aa299a6692677fd0ced6aae101f5c38925ad.json
Writing C:/Users/Username/AppData/Local/Composer/repo/http---localhost-4170/provider-zendframework$zend-escaper.json into cache
Resolving dependencies through SAT

Dependency resolution completed in 0.001 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - zendframework/zend-httphandlerrunner 1.1.0 requires psr/http-message-implementation ^1.0 -> no matching package found.
    - zendframework/zend-expressive 3.2.1 requires zendframework/zend-httphandlerrunner ^1.0.1 -> satisfiable by zendframework/zend-httphandlerrunner[1.1.0].
    - Installation request for zendframework/zend-expressive ^3.2 -> satisfiable by zendframework/zend-expressive[3.2.1].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Duplicate issue #584: Virtual packages will not be found if I use providers=true in satis.json
Created: 2020-02-09T17:47:11Z
I have the following problem with virtual packages: I want to integrate the package geocoder-php/common-http into my application. This has the php-http/client-implementation package as a dependency, which is a virtual package. As a concrete implementation I use php-http/guzzle6-adapter. So my satis.json looks like this:
{
    "name": "private/repo",
    "homepage": "http://localhost",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packagist.org"
        }
    ],
    "require": {
        "geocoder-php/common-http": "*",
        "php-http/guzzle6-adapter": "*"
    },
    "require-dependencies": true,
    "require-dev-dependencies": true,
    "providers": true,
    "archive": {
        "directory": "dist",
        "format": "zip",
        "skip-dev": true
    }
}

I run "satis build" and everything is downloaded correctly.
Now I want to use the packages in my application and have created the following composer.json:
{
    "name": "private/myapp",
    "type": "project",
    "repositories": [
        {
            "packagist": false
        },
        {
            "type": "composer",
            "url": "http://localhost"
        }
    ],
    "config": {
        "secure-http": false
    },
    "require": {
        "php": "^7.2",
        "geocoder-php/common-http": "^4.2",
        "php-http/guzzle6-adapter": "^2.0"
    }
}

If I now run a "composer install", I get the following error message:
  Problem 1
    - Installation request for geocoder-php/common-http ^4.2 -> satisfiable by geocoder-php/common-http[4.2.0].
    - geocoder-php/common-http 4.2.0 requires php-http/client-implementation ^1.0 -> no matching package found.

It seems that the guzzle6-adapter, which provides the client-implementation, is not considered at all. Is this a bug? How can I configure Satis so that the composer can find all the packages I need in my repository?

Closing comment (2020-02-10T13:03:33Z): Looks like a duplicate of #529 actually. Closing to keep the conversation/issue limited to a single thread.