Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Http Client Bundle Laravel Package

dormilich/http-client-bundle

View on GitHub
Deep Wiki
Context7

http-client bundle

Symfony 5 bundle for dormilich/http-client.

Installation

This bundle requires Symfony 5 as well as a PSR-17 and PSR-18 implementation.

However, it makes sense to use symfony/http-client as PSR-18 implementation in a Symfony project.

You can then install this bundle via composer:

composer require dormilich/http-client-bundle

Configuration

The configuration allows the predefined JSON- and URL-transformers to be set up. By default, the JSON-transformers are set up without options and the URL-transformers with the php strategy.

The JSON-encoder/decoder accepts JSON_* constants as constructor argument. They can be added using the encoder.json/decoder.json key.

The URL-encoder/decoder can be configured with two encoding strategies, php (native PHP parsing strategy, used for populating $_GET and $_POST) and nvp (a strategy that uses name=value pairs) using the encoder.url/decoder.url key.

Example:

# config/packages/dormilich_http_client.yaml
dormilich_http_client:
  encoder:
    url: php
  decoder:
    json: !php/const JSON_OBJECT_AS_ARRAY

Tagging

The bundle allows the HTTP client to be configured in services.yaml using service tags.

  • dormilich_http_client.client_decoder: Add tagged decoder to the client
  • dormilich_http_client.client_encoder: Add tagged encoder to the client
  • dormilich_http_client.client_transformer: Add tagged data transformer/encoder/decoder to the client

Examples:

# add error decoder to every client instance
Dormilich\HttpClient\Decoder\ErrorDecoder:
  tags:
    - dormilich_http_client.client_decoder
# encode JSON objects
Dormilich\HttpClient\Transformer\JsonEncoder:
    tags:
        - dormilich_http_client.client_transformer
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware