Show that we supoprt PSR-18

This commit is contained in:
Tobias Nyholm 2019-02-03 18:07:20 +01:00 committed by David Garcia
parent 0bcc9b3aa5
commit f50304aa65

View File

@ -24,25 +24,21 @@ composer:
curl -sS https://getcomposer.org/installer | php curl -sS https://getcomposer.org/installer | php
``` ```
The Mailgun api client is not hard coupled to Guzzle or any other library that sends HTTP messages. It uses an abstraction The Mailgun api client is not hard coupled to Guzzle or any other library that sends
called HTTPlug. This will give you the flexibilty to choose what PSR-7 implementation and HTTP client to use. HTTP messages. It uses the [PSR-18](https://www.php-fig.org/psr/psr-18/) client abstraction.
This will give you the flexibilty to choose what PSR-7 implementation and HTTP client to use.
If you just want to get started quickly you should run the following command: If you just want to get started quickly you should run the following command:
```bash ```bash
php composer.phar require mailgun/mailgun-php php-http/curl-client guzzlehttp/psr7 composer require mailgun/mailgun-php kriswallsmith/buzz nyholm/psr7
``` ```
### Why requiring so many packages?
Mailgun has a dependency on the virtual package
[php-http/client-implementation](https://packagist.org/providers/php-http/client-implementation) which requires you to install **an** adapter, but we do not care which one. That is an implementation detail in your application. We also need **a** PSR-7 implementation and **a** message factory.
You do not have to use the `php-http/curl-client` if you do not want to. You may use the `php-http/guzzle6-adapter`. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the [HTTPlug docs](http://docs.php-http.org/en/latest/httplug/users.html).
## Usage ## Usage
You should always use Composer's autoloader in your application to automatically load the your dependencies. All examples below assumes you've already included this in your file: You should always use Composer's autoloader in your application to automatically load
the your dependencies. All examples below assumes you've already included this in your
file:
```php ```php
require 'vendor/autoload.php'; require 'vendor/autoload.php';
@ -172,7 +168,6 @@ We are currently building a new object oriented API client. Feel free to contrib
* Create issues if you find problems * Create issues if you find problems
* Reply to other people's issues * Reply to other people's issues
* Review PRs * Review PRs
* Write PR. You find our current milestone [here](https://github.com/mailgun/mailgun-php/milestone/1)
### Running the test code ### Running the test code