Git Product home page Git Product logo

Comments (15)

yidas avatar yidas commented on June 6, 2024 1

Got it.
It can be a goal, and once it's implemented we can remove Guzzle dependency.

from google-maps-services-php.

dereuromark avatar dereuromark commented on June 6, 2024

Looks like this could be included in #8 right?

from google-maps-services-php.

yidas avatar yidas commented on June 6, 2024

It looks like in #8, the composer is still using Guzzle.

I think it's inconvenient to maintain a PHP client without a mainstream HTTP client package.

from google-maps-services-php.

garak avatar garak commented on June 6, 2024

@yidas you can still include Guzzle of course, but without forcing other people to use it

from google-maps-services-php.

yidas avatar yidas commented on June 6, 2024

Hi @garak,

As I know, PSR-18 is the definition of the client interface.
May I know more about how you actually want to achieve?

from google-maps-services-php.

garak avatar garak commented on June 6, 2024

I'd like to use this library without being forced to use Guzzle.
This would also improve the quality of the code, making it more SOLID.

from google-maps-services-php.

alex-kalanis avatar alex-kalanis commented on June 6, 2024

Possible with #8 -> instead of the whole client (facade there) just call inner processings

// ...
# today
$calls = new \yidas\googleMaps\Services(new \yidas\googleMaps\Clients\GuzzleClient(), new \yidas\googleMaps\Services\ServiceFactory(new \yidas\googleMaps\ApiAuth($optParams)));
# via PSR
$calls = new \yidas\googleMaps\Services(new \yidas\googleMaps\Clients\PsrClient($yourPsrClient), new \yidas\googleMaps\Services\ServiceFactory(new \yidas\googleMaps\ApiAuth($optParams)));
// ...

from google-maps-services-php.

garak avatar garak commented on June 6, 2024

Not a good idea: dependencies should be injected, not instantiated (again, to be SOLID)

from google-maps-services-php.

dereuromark avatar dereuromark commented on June 6, 2024

I think the main issue remaining is

    "require": {
        ...
        "guzzlehttp/guzzle": "~6.5.6|^7.4.3"
    },

There should be a solution to require the abstract only, not the concrete.
my guess: https://packagist.org/packages/psr/http-client
That's probably what he mainly means.

If we have to major now anyways, with that PR being merged, maybe this is the chance to also clean up that dependency issue

from google-maps-services-php.

alex-kalanis avatar alex-kalanis commented on June 6, 2024

@garak : So you just call

class Something
{
    public function __construct(
        protected \yidas\googleMaps\Services $service
    ) {}
}

And set the rest of dependency tree somewhere else... Like in neon config

parameters:
  apiKey: YOUR_API_KEY

services:
  - yidas\googleMaps\ApiAuth(%apiKey%)
  - yidas\googleMaps\Services\ServiceFactory
  - yidas\googleMaps\Clients\PsrClient
  - yidas\googleMaps\Services

I see no problem.

from google-maps-services-php.

garak avatar garak commented on June 6, 2024

@alex-kalanis I was talking about the relationship between \yidas\googleMaps\Services and the HTTP client

from google-maps-services-php.

dereuromark avatar dereuromark commented on June 6, 2024

To which I added context that clarifies it further :)

"require": {
    ...
    "psr/http-client": "^1.0.3"
},

and move guzzle to require-dev for test harness (as default)

from google-maps-services-php.

garak avatar garak commented on June 6, 2024

I'm not sure to understand how it was clarified... the only relevant subject here is the constructor of the class receiving the HTTP client

from google-maps-services-php.

dereuromark avatar dereuromark commented on June 6, 2024

No, also the compose require part as outlined in my previous comment here :) Otherwise you gain nothing really.

from google-maps-services-php.

garak avatar garak commented on June 6, 2024

That can be relevant elsewhere, just not relevant here.

from google-maps-services-php.

Related Issues (7)

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.