Skip to content

cleanup virtual package doc #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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