Open walva opened 5 years ago
Hi @SulivanDotEu
I encountered the same problem as you and tested most of your installs. In the end, here is what I've done to fix it :
composer require symfony/http-client
(if not already in your dependencies)psr/http-client
is required by this bundle, but you can add it as root dependencycomposer require nyholm/psr7
composer require happyr/google-analytics-bundle
. Here my setup for the bundle
happyr_google_analytics:
tracking_id: '%env(GOOGLE_ANALYTICS_TRACKING_ID)%'
http_client: 'Psr\Http\Client\ClientInterface'
http_message_factory: 'nyholm.psr7.psr17_factory'
Symfony autowiring is able to resolve Psr\Http\Client\ClientInterface
because, in my case, there is only one implementation.
I also made it work with HTTPlug Bundle by configuring a client and then use
happyr_google_analytics:
tracking_id: '%env(GOOGLE_ANALYTICS_TRACKING_ID)%'
http_client: 'httplug.client.happyr_analytics'
http_message_factory: 'nyholm.psr7.psr17_factory'
And httplug.client.happyr_analytics
relies on
httplug:
# ...
clients:
# ...
happyr_analytics:
http_methods_client: true
I hope it will help
I install (Symfony 4.3)
composer require symfony/http-client (if not already in your dependencies) psr/http-client is required by this bundle, but you can add it as root dependency composer require nyholm/psr7 composer require happyr/google-analytics-bundle
and composer require php-http/httplug-bundle
config :
happyr_google_analytics: tracking_id: 11111 http_client: 'httplug.client.happyr_analytics' http_message_factory: 'nyholm.psr7.psr17_factory'
httplug: plugins: retry: retry: 1
discovery:
client: 'auto'
clients:
happyr_analytics:
http_methods_client: true
app:
http_methods_client: true
plugins:
- 'httplug.plugin.content_length'
- 'httplug.plugin.redirect'
But still have an error
Argument 1 passed to Happyr\GoogleAnalyticsBundle\Http\HttpClient::__construct() must be an instance of Psr\Http\Client\ClientInterface, instance of Http\Client\Common\HttpMethodsClient given,
ok I change
happyr_google_analytics: tracking_id: UA-1634831-41 http_client: 'Psr\Http\Client\ClientInterface' http_message_factory: 'nyholm.psr7.psr17_factory'
now it work. installing this bundle is very complicated
Hi there!
I am very interested in using this bundle for our project but we couldn't achieve to install it and make it work.
So I tried to reproduce our error in a brand new project. Here are the step I followed:
symfony new httpclient
composer require symfony/maker-bundle
composer require template
composer require annotations
php bin\console make:controller
composer require happyr/google-analytics-bundle
composer require php-http/curl-client guzzlehttp/psr7 php-http/message
-> didn't work because of the error message:
composer require php-http/httplug-bundle php-http/curl-client guzzlehttp/psr7
composer require php-http/guzzle6-adapter
at this point, the kernel is compiling correctly and we created the branch master of our test project
Here is the error I have:
Because the bundle still wasn't working, I tried to use Symfony HttpClient in the other branch use-symfony-client
git checkout use-symfony-client
composer require symfony/http-client
composer require psr/http-client
composer require nyholm/psr7
Here is the error:
At this point, I honestly don't know what to do :s I'm here to help with my limited knowledge of php http client ecosystem.
Best regards, Benjamin