Comments (7)
This sounds like an exception being raised by Symfony. The bug is probably with them.
from httplug.
The code behind: HttplugClient
class is:
if (!interface_exists(HttplugInterface::class)) {
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/httplug" package is not installed. Try running "composer require php-http/httplug".');
}
if (!interface_exists(RequestFactory::class)) {
throw new \LogicException('You cannot use "Symfony\Component\HttpClient\HttplugClient" as the "php-http/message-factory" package is not installed. Try running "composer require nyholm/psr7".');
}
/**
* An adapter to turn a Symfony HttpClientInterface into an Httplug client.
*
* Run "composer require nyholm/psr7" to install an efficient implementation of response
* and stream factories with flex-provided autowiring aliases.
*
* @author Nicolas Grekas <[email protected]>
*/
final class HttplugClient implements HttplugInterface, HttpAsyncClient, RequestFactory, StreamFactory, UriFactory
{
If I put in my code:
if (!interface_exists(HttplugInterface::class)) {
// Some code.
}
The code inside de if
always executes.
from httplug.
yep, as the code says. if you want to instantiate the symfony client HttpPlugClient adapter, you need to require php-http/httplug.
if you use the symfony framework, just typehint Symfony\Contracts\HttpClient\HttpClientInterface to get injected the right client.
if you don't care what client you use, i'd recommend to instantiate the curl client or native stream client as explained at:
https://symfony.com/doc/4.4/http_client.html#enabling-curl-support
from httplug.
yep, as the code says. if you want to instantiate the symfony client HttpPlugClient adapter, you need to require php-http/httplug.
It is installed, see the output of my composer show
on my first comment.
from httplug.
Can you please share your composer.json
file?
from httplug.
Yes, sure:
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 9 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.9",
"cweagans/composer-patches": "^1.7",
"drupal/admin_toolbar": "^3.0",
"drupal/block_field": "^1.0@RC",
"drupal/core-composer-scaffold": "^9.1",
"drupal/core-project-message": "^9.1",
"drupal/core-recommended": "^9.1",
"drupal/editor_advanced_link": "^1.8",
"drupal/editor_file": "^1.5",
"drupal/entity_embed": "^1.1",
"drupal/entity_usage": "^2.0@beta",
"drupal/feeds": "^3.0@alpha",
"drupal/field_config_cardinality": "^1.1",
"drupal/field_group": "^3.1",
"drupal/gtm": "^1.6",
"drupal/link_attributes": "^1.11",
"drupal/mailsystem": "^4.3",
"drupal/metatag": "^1.16",
"drupal/owlcarousel": "^1.0@alpha",
"drupal/paragraphs": "^1.12",
"drupal/paragraphs_ee": "^1.7",
"drupal/paragraphs_features": "^1.11",
"drupal/pathauto": "^1.8",
"drupal/quicklink": "^2.0@beta",
"drupal/rabbit_hole": "^1.0@beta",
"drupal/redirect": "^1.6",
"drupal/scheduler": "^1.3",
"drupal/search_api": "^1.19",
"drupal/sendgrid_integration": "^1.7",
"drupal/simple_recaptcha": "^1.0@beta",
"drupal/simple_sitemap": "^3.10",
"drupal/structured_data": "^1.2",
"drupal/swiftmailer": "^2.0",
"drupal/token": "^1.9",
"drupal/token_filter": "^1.2",
"drupal/twig_field_value": "^2.0",
"drupal/twig_tweak": "^3.0",
"drupal/views_accordion": "^2.0",
"drupal/views_slideshow": "^4.8",
"drupal/webform": "^6.0",
"drush/drush": "^10.4",
"guzzlehttp/promises": "^1.4",
"nyholm/psr7": "^1.3",
"php-http/httplug": "^2.2",
"symfony/http-client": "^4.4"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": [
"type:drupal-core"
],
"web/libraries/{$name}": [
"type:drupal-library"
],
"web/modules/contrib/{$name}": [
"type:drupal-module"
],
"web/profiles/contrib/{$name}": [
"type:drupal-profile"
],
"web/themes/contrib/{$name}": [
"type:drupal-theme"
],
"drush/Commands/contrib/{$name}": [
"type:drupal-drush"
],
"web/modules/custom/{$name}": [
"type:drupal-custom-module"
],
"web/profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"web/themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}
from httplug.
sorry, i overlooked that you have php-http/httplug installed.
but then it sounds like an issue with autoloading or something.
looking at https://github.com/symfony/http-client/blob/5.3/HttplugClient.php, i see that the "HttplugInterface" is an alias from our HttpClient interface. when you tried in your own code, did you also create the alias?
from httplug.
Related Issues (20)
- HttpFulfilledPromise constructor parameter should be mixed HOT 3
- Circuit Breaker HOT 6
- Missing badges HOT 2
- Sending file from a multipart stream HOT 13
- Add support for HTTP proxies and SSL Client certificates? HOT 7
- How to set timeout for a request while being abstracted from a HttpClient implementation? HOT 6
- Implementation Question: how to code Client options in a library-agnostic way? HOT 5
- Benchmarks? HOT 2
- Prepare version 2.0 HOT 6
- HMAC Authentication Plugin HOT 4
- phpstan complains about Http\Client\Exception HOT 6
- Adding deprecated HOT 5
- HttpException create method self vs static HOT 1
- Symfony HTTP Client Adapter HOT 1
- PSR-18: Network / Request exception inheritance HOT 1
- Add psr-18 github tag HOT 1
- Throwable not supported HOT 8
- State of async HTTP clients and promises HOT 13
- PHP 8.0 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from httplug.