Skip to content

Dependency on psr/http-message-implementation #104

Closed
@Nyholm

Description

@Nyholm

I feel like we need a dependency on psr/http-message-implementation but I can not decide what package that should have that dependency. Technically no package require an implementation because that is one of our goals, but in practice you can not use any package without an implementation of PSR-7.

The scenario is that an API library uses Httplug it has dependencies like:

    "require": {
        "php": "^5.5|^7.0",
        "php-http/client-implementation": "1.0",
        "php-http/httplug": "v1.0.0-beta",
        "php-http/message": "^0.2.1",
        "php-http/discovery": "^0.6"
    },

The user tries to install the library and will first get an error like:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package php-http/client-implementation could not be found in any version,
    there may be a typo in the package name.

So he googles the error and finds our our documentation saying he need a client. He tries to install the socket-client.

$ composer require php-http/socket-client

Everything installs but when one tries to use the library which have auto discovery you will get an exception:

Uncaught exception 'Http\Discovery\NotFoundException' with message 'Resource of type "Http\Message\MessageFactory" not found' in /Users/tobias/Workspace/tmp/vendor/php-http/discovery/src/ClassDiscovery.php:114

This will happen because we have no implementation of PSR-7 installed. The user has faced a lot of issues and the experience of Httplug is that it is hard do use and understand.

I would suggest we add a dependency on psr/http-message-implementation on one of following:

  • Httplug
  • Message factory
  • Discovery
  • All clients/adapters

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions