Skip to content

Commit

Permalink
Merge pull request #26 from php-http/avoid-duplication
Browse files Browse the repository at this point in the history
cleanup virtual package doc
  • Loading branch information
dbu committed Nov 5, 2015
2 parents 043d26c + b7d042e commit 78aaee4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/httplug.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ Note: Until Httplug 1.0 becomes stable, we will focus on the Guzzle6 adapter.

## Usage in a project

When writing an application, you need to require a concrete [client implementation](https://packagist.org/providers/php-http/client-implementation). The client will in turn depend on `php-http/httplug`, thus you do not need to duplicate the dependency on `php-http/httplug` in your composer.json file. However, if your code depends on a minimal version of Httplug, specify it to have composer report problems rather than the application failing at some point.
When writing an application, you need to require a concrete [client implementation](https://packagist.org/providers/php-http/client-implementation).

Choose the client based on your personal preferences or dependencies of your project. If your preferred client has no Httplug adapter, submit one.
See [virtual package](virtual-package.md) for more information on the topic of working with HTTPlug implementations.


## Installation in a reusable package
Expand Down
6 changes: 5 additions & 1 deletion docs/virtual-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Virtual packages are a way to specify the dependency on an implementation of an
There is no project registered with that name. However, all client implementations including client adapters for Httplug use the `provide` section to tell composer that they do provide the client-implementation.


# Using a Reusable Library
# Using a Library that depends on HTTPlug

Reusable libraries do not depend on a concrete implementation but only on the virtual package `php-http/client-implementation`. This is to avoid hard coupling and allows the user of the library to choose the implementation. You can think of this as an "interface" or "contract" for packages.

Expand All @@ -27,6 +27,10 @@ Doing something like the following will make this problem go away:
$ composer require php-http/guzzle6-adapter
```

Pick a client based on your personal preferences or dependencies of your project. If your preferred client has no Httplug adapter, submit one.

The client will in turn depend on `php-http/httplug`, thus you do not need to duplicate the dependency on `php-http/httplug` in your composer.json file. However, if your code depends on a minimal version of Httplug, specify it to have composer report problems rather than the application failing at some point.


# Building a Reusable Library

Expand Down

0 comments on commit 78aaee4

Please sign in to comment.