From 4e0ee059adddeef45efd88a99ceda38e525e3338 Mon Sep 17 00:00:00 2001 From: Lennard Voogdt Date: Tue, 3 Oct 2017 10:58:19 +0200 Subject: [PATCH] Updated the first example The example didn't work when i tried, this one works --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index b651102..6dd9ef2 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ The following example creates a request object, based on the current browser req ```php use Proxy\Proxy; use Proxy\Adapter\Guzzle\GuzzleAdapter; -use Proxy\Filter\RemoveEncodingFilter; -use Zend\Diactoros\ServerRequestFactory; +use Proxy\Response\Filter\RemoveEncodingFilter; +use Symfony\Component\HttpFoundation\Request; // Create a PSR7 request based on the current browser request. -$request = ServerRequestFactory::fromGlobals(); +$request = Request::createFromGlobals(); // Create a guzzle client $guzzle = new GuzzleHttp\Client(); @@ -32,13 +32,12 @@ $guzzle = new GuzzleHttp\Client(); $proxy = new Proxy(new GuzzleAdapter($guzzle)); // Add a response filter that removes the encoding headers. -$proxy->filter(new RemoveEncodingFilter()); +$proxy->addResponseFilter(new RemoveEncodingFilter()); // Forward the request and get the response. $response = $proxy->forward($request)->to('http://example.com'); -// Output response to the browser. -(new Zend\Diactoros\Response\SapiEmitter)->emit($response); +$response->send(); ``` ## Filters