Giter VIP home page Giter VIP logo

Comments (13)

omares avatar omares commented on August 19, 2024

I moved the questioned code parts into own classes (filters), so its configurable/enableable by the user now ;) rebuy-de/php-proxy#1

To use that new feature you would have to accept my PR #11 which includes a few BC-Breaks

from php-proxy.

jenssegers avatar jenssegers commented on August 19, 2024

The location rewrite is to prevent the user to be redirected to a different url immediately. Somethings it makes the user follow redirects in a loop, in other situations it can be helpful.

The transfer-encoding and content-encoding are removed so that the own webserver can set the correct headers if it uses a different encoding method.

from php-proxy.

jenssegers avatar jenssegers commented on August 19, 2024

I think it would be interesting to create some sort of Proxy\Transport interface/abstract class that handles the conversion of the Symfony request object to the actual Guzzle objects. For Guzzle there would then be a Proxy\GuzzleTransport class.

from php-proxy.

omares avatar omares commented on August 19, 2024

The location rewrite is to prevent the user to be redirected to a different url immediately. Somethings it makes the user follow redirects in a loop, in other situations it can be helpful.

Ah i see, wouldnt it be better then to remove the location header and add is as a X-PHPProxy-Location Header?

The transfer-encoding and content-encoding are removed so that the own webserver can set the correct headers if it uses a different encoding method.

Okay, works for me.

I think it would be interesting to create some sort of Proxy\Transport interface/abstract class that handles the conversion of the Symfony request object to the actual Guzzle objects. For Guzzle there would then be a Proxy\GuzzleTransport class.

Basically thats exactly what i created with my converters in the referenced rebuy-de/php-proxy#1 PR

Btw. under which license is phpproxy published?

from php-proxy.

jenssegers avatar jenssegers commented on August 19, 2024

I quickly released this version because I wanted to integrate Symfony request and response objects. I will be making changes as soon as I can find some spare time.

All my packages are MIT.

from php-proxy.

omares avatar omares commented on August 19, 2024

Hehe, how big are the chances you would merge the #11 PR? :)

from php-proxy.

jenssegers avatar jenssegers commented on August 19, 2024

Your PR has some great additions, but there are some things I would change though. Instead of the RequestConverterInterface, I would use "transporters" (or whatever) that receive a Symfony Request, do the actual http request and return a Symfony Response. I really like your filters. And I don't know about the namespace, wouldn't Proxy\Factory look nicer than Phpproxy\Factory?

from php-proxy.

omares avatar omares commented on August 19, 2024

I would use "transporters" or whatever that receive a Symfony Request and return a Symfony Response.

Is the Converters vs Transportes just a naming issue? Or does symfony have a transporter module?

And I don't know about the namespace, wouldn't Proxy\Factory look nicer than Phpproxy\Factory?

Sure i am totally fine and agree with that. The namespace is based on the repository name ;). Or we could call it Phproxy :P

from php-proxy.

jenssegers avatar jenssegers commented on August 19, 2024

Transporters, clients, ... I don't know what the best name would be. It would work like this: when you construct a Proxy object, you inject a Transporter/Client instance using the constructor. The Proxy object is requested to forward a Symfony request to a certain url and after doing some filters, it passed the Request to the transporter/client which will return a Symfony Response. This way, the transporter will take care of converting the Request to something that it can use.

This way you would be able to do stuff like this:

$proxy = new Proxy(new GuzzleTansporter);

Or a:

$proxy = new Proxy(new DummyTransporter);

Or a:

$proxy = new Proxy(new CurlTransporter);

from php-proxy.

omares avatar omares commented on August 19, 2024

Great idea! I'll try to implement that :)

from php-proxy.

jenssegers avatar jenssegers commented on August 19, 2024

And the included Factory can just create a Proxy instance with a default GuzzleClient/GuzzleTransporter.

from php-proxy.

omares avatar omares commented on August 19, 2024

Here we go, the PR now includes Adapters (aka Transports) and the updated namespace.
On second thought one could simply change the Adapter that guzzle uses, but the change makes the code more readable.

from php-proxy.

omares avatar omares commented on August 19, 2024

Btw, i will close this issue now. We should continue our discussion in the #11 PR.
I am keen to read your feedback.

from php-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.