Skip to content

Commit e05577d

Browse files
committed
Merge pull request #70 from php-http/move_plugins
Move plugins
2 parents 9395b4f + 00012ab commit e05577d

26 files changed

+119
-117
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
4+
## Unreleased
5+
6+
### Deprecated
7+
8+
- Core plugins and plugin client, moved to [client-common](https://github.com/php-http/client-common)
9+
- Logger plugin, moved to [logger-plugin](https://github.com/php-http/logger-plugin)
10+
- Cache plugin, moved to [cache-plugin](https://github.com/php-http/cache-plugin)
11+
- Stopwatch plugin, moved to [stopwatch-plugin](https://github.com/php-http/stopwatch-plugin)
12+
13+
314
## 1.0.1 - 2016-01-29
415

516
### Changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"php": ">=5.4",
1515
"php-http/httplug": "^1.0",
1616
"php-http/message-factory": "^1.0.2",
17-
"php-http/client-common": "^1.0",
17+
"php-http/client-common": "^1.1",
1818
"php-http/message": "^1.0",
1919
"symfony/options-resolver": "^2.6|^3.0"
2020
},

src/AddHostPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\AddHostPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\AddHostPlugin instead.', E_USER_DEPRECATED);
6+
57
use Psr\Http\Message\RequestInterface;
68
use Psr\Http\Message\UriInterface;
79
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -10,6 +12,8 @@
1012
* Add schema and host to a request. Can be set to overwrite the schema and host if desired.
1113
*
1214
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
15+
*
16+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\AddHostPlugin} instead.
1317
*/
1418
class AddHostPlugin implements Plugin
1519
{

src/AuthenticationPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\AuthenticationPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\AuthenticationPlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Message\Authentication;
68
use Psr\Http\Message\RequestInterface;
79

810
/**
911
* Send an authenticated request.
1012
*
1113
* @author Joel Wurtz <joel.wurtz@gmail.com>
14+
*
15+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\AuthenticationPlugin} instead.
1216
*/
1317
class AuthenticationPlugin implements Plugin
1418
{

src/CachePlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\CachePlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\CachePlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Message\StreamFactory;
68
use Http\Promise\FulfilledPromise;
79
use Psr\Cache\CacheItemPoolInterface;
@@ -13,6 +15,8 @@
1315
* Allow for caching a response.
1416
*
1517
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
18+
*
19+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\CachePlugin} instead.
1620
*/
1721
class CachePlugin implements Plugin
1822
{

src/ContentLengthPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\ContentLengthPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\ContentLengthPlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Message\Encoding\ChunkStream;
68
use Psr\Http\Message\RequestInterface;
79

810
/**
911
* Allow to set the correct content length header on the request or to transfer it as a chunk if not possible.
1012
*
1113
* @author Joel Wurtz <joel.wurtz@gmail.com>
14+
*
15+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\ContentLengthPlugin} instead.
1216
*/
1317
class ContentLengthPlugin implements Plugin
1418
{

src/CookiePlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\CookiePlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\CookiePlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception\TransferException;
68
use Http\Message\Cookie;
79
use Http\Message\CookieJar;
@@ -12,6 +14,8 @@
1214
* Handle request cookies.
1315
*
1416
* @author Joel Wurtz <joel.wurtz@gmail.com>
17+
*
18+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\CookiePlugin} instead.
1519
*/
1620
class CookiePlugin implements Plugin
1721
{

src/DecoderPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\DecoderPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\DecoderPlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Message\Encoding\DechunkStream;
68
use Http\Message\Encoding\DecompressStream;
79
use Http\Message\Encoding\GzipDecodeStream;
@@ -19,6 +21,8 @@
1921
* If Content-Encoding is not disabled, the plugin will add an Accept-Encoding header for the encoding methods it supports.
2022
*
2123
* @author Joel Wurtz <joel.wurtz@gmail.com>
24+
*
25+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\DecoderPlugin} instead.
2226
*/
2327
class DecoderPlugin implements Plugin
2428
{

src/ErrorPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\ErrorPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\ErrorPlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Plugin\Exception\ClientErrorException;
68
use Http\Client\Plugin\Exception\ServerErrorException;
79
use Psr\Http\Message\RequestInterface;
@@ -13,6 +15,8 @@
1315
* By default an exception will be thrown for all status codes from 400 to 599.
1416
*
1517
* @author Joel Wurtz <joel.wurtz@gmail.com>
18+
*
19+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\ErrorPlugin} instead.
1620
*/
1721
class ErrorPlugin implements Plugin
1822
{

src/Exception/CircularRedirectionException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace Http\Client\Plugin\Exception;
44

5+
@trigger_error('The '.__NAMESPACE__.'\CircularRedirectionException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\CircularRedirectionException instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception\HttpException;
68

79
/**
810
* Thrown when circular redirection is detected.
911
*
1012
* @author Joel Wurtz <joel.wurtz@gmail.com>
13+
*
14+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\CircularRedirectionException} instead.
1115
*/
1216
class CircularRedirectionException extends HttpException
1317
{

src/Exception/ClientErrorException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace Http\Client\Plugin\Exception;
44

5+
@trigger_error('The '.__NAMESPACE__.'\ClientErrorException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\ClientErrorException instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception\HttpException;
68

79
/**
810
* Thrown when there is a client error (4xx).
911
*
1012
* @author Joel Wurtz <joel.wurtz@gmail.com>
13+
*
14+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\ClientErrorException} instead.
1115
*/
1216
class ClientErrorException extends HttpException
1317
{

src/Exception/LoopException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
namespace Http\Client\Plugin\Exception;
44

5+
@trigger_error('The '.__NAMESPACE__.'\LoopException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\LoopException instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception\RequestException;
68

79
/**
810
* @author Joel Wurtz <joel.wurtz@gmail.com>
11+
*
12+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\LoopException} instead.
913
*/
1014
class LoopException extends RequestException
1115
{

src/Exception/MultipleRedirectionException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace Http\Client\Plugin\Exception;
44

5+
@trigger_error('The '.__NAMESPACE__.'\MultipleRedirectionException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\MultipleRedirectionException instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception\HttpException;
68

79
/**
810
* Redirect location cannot be chosen.
911
*
1012
* @author Joel Wurtz <joel.wurtz@gmail.com>
13+
*
14+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\MultipleRedirectionException} instead.
1115
*/
1216
class MultipleRedirectionException extends HttpException
1317
{

src/Exception/ServerErrorException.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace Http\Client\Plugin\Exception;
44

5+
@trigger_error('The '.__NAMESPACE__.'\ServerErrorException class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Exception\ServerErrorException instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception\HttpException;
68

79
/**
810
* Thrown when there is a server error (5xx).
911
*
1012
* @author Joel Wurtz <joel.wurtz@gmail.com>
13+
*
14+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Exception\ServerErrorException} instead.
1115
*/
1216
class ServerErrorException extends HttpException
1317
{

src/HeaderAppendPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\HeaderAppendPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderAppendPlugin instead.', E_USER_DEPRECATED);
6+
57
use Psr\Http\Message\RequestInterface;
68

79
/**
@@ -13,6 +15,8 @@
1315
* @link https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
1416
*
1517
* @author Soufiane Ghzal <sghzal@gmail.com>
18+
*
19+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderAppendPlugin} instead.
1620
*/
1721
class HeaderAppendPlugin implements Plugin
1822
{

src/HeaderDefaultsPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\HeaderDefaultsPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderDefaultsPlugin instead.', E_USER_DEPRECATED);
6+
57
use Psr\Http\Message\RequestInterface;
68

79
/**
810
* Set default values for the request headers.
911
* If a given header already exists the value wont be replaced and the request wont be changed.
1012
*
1113
* @author Soufiane Ghzal <sghzal@gmail.com>
14+
*
15+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderDefaultsPlugin} instead.
1216
*/
1317
class HeaderDefaultsPlugin implements Plugin
1418
{

src/HeaderRemovePlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\HeaderRemovePlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderRemovePlugin instead.', E_USER_DEPRECATED);
6+
57
use Psr\Http\Message\RequestInterface;
68

79
/**
810
* Removes headers from the request.
911
*
1012
* @author Soufiane Ghzal <sghzal@gmail.com>
13+
*
14+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderRemovePlugin} instead.
1115
*/
1216
class HeaderRemovePlugin implements Plugin
1317
{

src/HeaderSetPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\HeaderSetPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HeaderSetPlugin instead.', E_USER_DEPRECATED);
6+
57
use Psr\Http\Message\RequestInterface;
68

79
/**
810
* Set headers to the request.
911
* If the header does not exist it wil be set, if the header already exists it will be replaced.
1012
*
1113
* @author Soufiane Ghzal <sghzal@gmail.com>
14+
*
15+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HeaderSetPlugin} instead.
1216
*/
1317
class HeaderSetPlugin implements Plugin
1418
{

src/HistoryPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\HistoryPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\HistoryPlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception;
68
use Psr\Http\Message\RequestInterface;
79
use Psr\Http\Message\ResponseInterface;
810

911
/**
1012
* Record http call.
13+
*
14+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\HistoryPlugin} instead.
1115
*/
1216
class HistoryPlugin implements Plugin
1317
{

src/Journal.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\Journal class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\Journal instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception;
68
use Psr\Http\Message\RequestInterface;
79
use Psr\Http\Message\ResponseInterface;
@@ -10,6 +12,8 @@
1012
* Records history of http calls.
1113
*
1214
* @author Joel Wurtz <joel.wurtz@gmail.com>
15+
*
16+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\Journal} instead.
1317
*/
1418
interface Journal
1519
{

src/LoggerPlugin.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Http\Client\Plugin;
44

5+
@trigger_error('The '.__NAMESPACE__.'\LoggerPlugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin\LoggerPlugin instead.', E_USER_DEPRECATED);
6+
57
use Http\Client\Exception;
68
use Http\Message\Formatter;
79
use Http\Message\Formatter\SimpleFormatter;
@@ -13,6 +15,8 @@
1315
* Log request, response and exception for a HTTP Client.
1416
*
1517
* @author Joel Wurtz <joel.wurtz@gmail.com>
18+
*
19+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin\LoggerPlugin} instead.
1620
*/
1721
class LoggerPlugin implements Plugin
1822
{

src/Plugin.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
namespace Http\Client\Plugin;
44

5-
use Http\Promise\Promise;
6-
use Psr\Http\Message\RequestInterface;
5+
@trigger_error('The '.__NAMESPACE__.'\Plugin class is deprecated since version 1.1 and will be removed in 2.0. Use Http\Client\Common\Plugin instead.', E_USER_DEPRECATED);
76

87
/**
98
* A plugin is a middleware to transform the request and/or the response.
@@ -14,17 +13,9 @@
1413
* - restart the request
1514
*
1615
* @author Joel Wurtz <joel.wurtz@gmail.com>
16+
*
17+
* @deprecated since since version 1.1, and will be removed in 2.0. Use {@link \Http\Client\Common\Plugin} instead.
1718
*/
18-
interface Plugin
19+
interface Plugin extends \Http\Client\Common\Plugin
1920
{
20-
/**
21-
* Handle the request and return the response coming from the next callable.
22-
*
23-
* @param RequestInterface $request
24-
* @param callable $next Next middleware in the chain, the request is passed as the first argument
25-
* @param callable $first First middleware in the chain, used to to restart a request
26-
*
27-
* @return Promise
28-
*/
29-
public function handleRequest(RequestInterface $request, callable $next, callable $first);
3021
}

0 commit comments

Comments
 (0)