Symfony Framework Integration for HTTPlug

Overview

HTTPlug Bundle

Latest Version Software License Build Status Code Coverage Quality Score Total Downloads

Symfony integration for HTTPlug.

Installation

To install the bundle with Symfony Flex, use the recipe:

$ composer require php-http/httplug-bundle

See the bundle documentation for installation without Flex and for further options. There is also a HTTPlug client list if you want to use a specific HTTP client.

Documentation

Please see the official documentation.

Testing

$ composer require --dev php-http/guzzle7-adapter
$ composer test

Contributing

Please see our contributing guide.

Security

If you discover any security related issues, please contact us at [email protected].

License

The MIT License (MIT). Please see License File for more information.

Comments
  • Make sure you can configure clients and register them as services

    Make sure you can configure clients and register them as services

    This will implement the feature mentioned in #10.

    This will let the user configure HttpClients for a specific implementation. Everything specific to a client, say guzzle5, is in one class.

    At the moment there is no validation of the special config. We just say: "The config you specify here is sent unparsed to Guzzle".

    opened by Nyholm 38
  • Improved collector

    Improved collector

    This PR is work in progress. I just want to show the progress. Please try it out and give me feedback. I believe the collector and extensions work properly. The work that is left is on the design and display of things.

    Related to #26

    TODO

    • [x] Only show the first request in the stack by default
    • [x] Show rest of the stack when you click "Show all"
    • [x] Hide the body of the request by default and add a "Show body" button.
    • [ ] Add nice design
    • [x] Maybe put different adapters on different pages. Design it like the translation "Translated"/"Fallback"/"Not translated"
    opened by Nyholm 35
  • Show plugins created without the Symfony config

    Show plugins created without the Symfony config

    | Q | A | | --- | --- | | Bug? | no | | New Feature? | question | | Version | |

    I just tested the bundle together with the knp github client. It is creating a PluginClient and adds a lot of extra plugins. I was (foolishly) expecting to see all plugin steps in the WebProfiler.

    Is it some way we could make this happen?... Or is it anyway one could configure the knp GitHub client differently?

    opened by Nyholm 29
  • Fix profiler for plugins like redirect

    Fix profiler for plugins like redirect

    | Q | A | --------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | fixes #121 | Documentation | n/a | License | MIT

    fix #121. The issue occurs when a plugin like redirect is triggered, it's code create a new request and then calls $first($newRequest). By doing so, the data collector is completely messed up and show the new request in the stack which created the request and in a new request stack.

    We have to find a way to not mess the display. My proposal is to inject in the debug stack a plugin that when called with a RequestInterface mark the beginning of a new request and when called with a ResponseInterface mark the end of the current request. If called with a RequestInterface twice without intermediary call with ResponseInterface, we could mark the beginning of a new request and also mark this new request as coming from the first one.

    Current panel rendering (1.8MB png)

    HttplugBundle configuration:

    httplug:
        clients:
            centrale:
                config:
                    timeout: 2
                factory: httplug.factory.guzzle6
                plugins:
                    - App\Http\Plugin\AuthorizationPlugin
                    - add_host:
                        host: 'localhost'
                    - header_set:
                        headers:
                            Accept: application/json
                    - httplug.plugin.error
                    - httplug.plugin.logger
                    - httplug.plugin.redirect
        plugins:
            logger:
                logger: monolog.logger.httplug
    

    The triggered request was GET /api/user which redirects to /api/entities/1e24fb4a-e250-11e6-b52d-0242ac140002

    To Do

    • [x] Write a fix!
    • [x] Write some internal documentation about profiling?
    • [x] Mark profiler classes as @internal.
    • [x] Fix existing unit tests.
    • [x] Write new unit tests.
    • [x] 2.7 compatibility.
    • [x] Update CHANGELOG.md.
    opened by fbourigault 27
  • Add configuration option to disable registration of default client

    Add configuration option to disable registration of default client

    | Q | A | --------------- | --- | Bug fix? | no | New feature? |yes | BC breaks? | no | Deprecations? | no | Related tickets | fixes #312 | Documentation | if this is a new feature, link to pull request in https://github.com/php-http/documentation that adds relevant documentation | License | MIT

    What's in this PR?

    This allows you to disable the registration of the default HTTPlug client.

    Why?

    We are heavily using Symfony's auto wire functionality. Sometimes, developer inject HttpClient in the constructor without actually specifying the exact httplug.client.name. No error is thrown, and HTTPlug just picks the httplug.client.default service (or the first client it can find)

    Checklist

    • [x] Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
    • [ ] Documentation pull request created
    opened by ruudk 26
  • Add compatibility with curl-client v2 (now relying on PSR17 factories)

    Add compatibility with curl-client v2 (now relying on PSR17 factories)

    | Q | A | --------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | yes | Deprecations? | no | Related tickets | fix #338 | License | MIT

    What's in this PR?

    This PR contains the compatibility with php-http/curl-client v2.

    Why?

    Installing the bundle with the curl-client will trigger that error now :

    Argument 1 passed to Http\Client\Curl\Client::__construct() must be an instance of Psr\Http\Message\ResponseFactoryInterface or null, instance of Nyholm\Psr7\Factory\HttplugFactory given, called in /vagrant/vendor/php-http/httplug-bundle/src/ClientFactory/CurlFactory.php on line 5
    

    Checklist

    • [x] Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
    • [ ] Documentation pull request created (if not simply a bugfix)

    To Do

    • [x] Handle compatibility with curl-client v1 in parallel of v2
    opened by shulard 25
  • Update composer.json for Symfony 4.

    Update composer.json for Symfony 4.

    | Q | A | --------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | --- | Documentation | --- | License | MIT

    What's in this PR?

    Update Symfony-related dependencies to allow 4.x-versions to make this bundle work in Symfony 4.0 applications. This PR requires php-http/stopwatch-plugin#4 to work.

    opened by dbrumann 20
  • missing for stable release

    missing for stable release

    lets collect what remains to be done and discuss here whether things must be in 1.0.0 or not. lets create issues for concrete tasks and reference them, and put them into https://github.com/php-http/HttplugBundle/milestones/1.0.0 if we think we need them.

    opened by dbu 20
  • Update design on WebProfiler

    Update design on WebProfiler

    | Q | A | | --- | --- | | Bug? | yes | | New Feature? | yes | | Version | n/a |

    Our WebProfiler has just been updated with much more information and new design. But there is room for improvements. If we look at @florianpreusner's Guzzle Bundle we see some nice screenshots of how it could look like.

    opened by Nyholm 18
  • Configure plugins

    Configure plugins

    This PR fixes #17

    httplug: 
      plugins: 
        cache:
          cache_pool: 'acme.cache'
          config: 
            respect_headers: true
        logger:
          formatter: 'acme.formatter'
    

    This make sure that you can configure all our 9 configurable plugins. Some plugins (like RetryPlugin) has only optional configuration. They are enabled by default. They others are disabled by default.

    Also, the LoggerPlugin is treated special. We inject the logger service automatically and it is enabled by default. This is done because of ease of use.

    opened by Nyholm 18
  • Add a discovery strategy

    Add a discovery strategy

    The clients found by discovery is not logged by the dev toolbar. This PR will add a new strategy that make sure we find a configured client.

    Problems

    We need to make sure constructor of ConfiguredClientsStrategy is executed. Because everything in the dependency injection is cached we can rely on that. A hack that will work is to register httplug.strategy as a event listener on kernel.request and console.command... Not sure if Im happy with that. Any input is welcome.

    This PR is blocked by

    • ~~https://github.com/php-http/discovery/pull/71~~
    • ~~https://github.com/php-http/discovery/pull/66~~
    opened by Nyholm 17
  • make internal classes final and mark other classes that will be final in 2.0

    make internal classes final and mark other classes that will be final in 2.0

    | Q | A | --------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Related tickets | prepare for #317 | Documentation | - | License | MIT

    What's in this PR?

    Declaring final all classes that already are marked as @internal. Marking with @final all other classes that should be final. Making them final is technically a BC break, so we do that only in the next major.

    opened by dbu 9
  • WIP configure seekable body plugin

    WIP configure seekable body plugin

    | Q | A | --------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | bundle integration of https://github.com/php-http/client-common/pull/167 | Documentation | - | License | MIT

    To Do

    • [ ] Finish the configuration and make tests work
    opened by dbu 0
  • Next Major: Make classes final where possible

    Next Major: Make classes final where possible

    | Q | A | ------------ | --- | Bug? | no | New Feature? | no | Version | BC breaking change: Next major

    Classes like the factories are not final. We should go over the bundle and make everything final that is not explicitly intended to be extended. Also check for things with protected visibility and make them private where possible.

    opened by dbu 1
  • Default config (and plugins)

    Default config (and plugins)

    | Q | A | ------------ | --- | Bug? | no | New Feature? | yes | Version | 1.10.0

    Actual Behavior

    On each client we configure, we have to define the plugins we want. In case of plugin we want everywhere, we have to repeat the configuration on each of them.

    Expected Behavior

    The idea is to allow a common client configuration to be applied on each defined client.

    With that, we will be able to define common plugin setup with ease. We can also think about it for other option like http_methods_client.

    Sample:

    httplug:
        default:
            http_methods_client: true
            plugins:
                - 'httplug.plugin.logger'
        clients:
            default:
                factory: 'httplug.factory.guzzle6'
                config:
                    timeout: 5
            cacheable:
                factory: 'httplug.factory.guzzle6'
                plugins:
                    - 'httplug.plugin.cache'
            dummy:
                factory: 'httplug.factory.guzzle6'
                http_methods_client: false
        profiling:
            captured_body_length: 1000
    

    What do you think?

    opened by soullivaneuh 3
  • Profiler does not show response if Cache plugin is used

    Profiler does not show response if Cache plugin is used

    | Q | A | ------------ | --- | Bug? | yes | New Feature? | no | Version | 1.8.1

    Without using cache plugin:

    Now do this

                plugins:
                    - 'httplug.plugin.content_length'
                    - 'httplug.plugin.redirect'
    +               - 'httplug.plugin.cache'
    

    Result: screenshot from 2018-01-06 19-50-09

    I'm aware this is because Cache plugin does not pass response over to other middlewares when cache is hit, but this is major usability restriction of Profiler. I would like to not wait for response while developing, but still see responses pulled out of Cache plugin. There should be a workaround in place

    bug 
    opened by ostrolucky 6
Releases(1.27.0)
  • 1.27.0(Jul 25, 2022)

  • 1.26.2(Jun 1, 2022)

  • 1.26.1(Apr 29, 2022)

    • Fixed: Setting the cache plugin option respect_response_cache_directives to null makes the plugin use the default set of directives instead of triggering an error.
    Source code(tar.gz)
    Source code(zip)
  • 1.26.0(Mar 17, 2022)

  • 1.25.0(Nov 26, 2021)

  • 1.24.0(Oct 23, 2021)

    • Changed stopwatch category from default to "httplug", so it's more prominent on Execution timeline view
    • Changed tab texts inside profiler so that it shows ports in URL in case it's non-standard
    • Changed default logging plugin monolog channel from "app" to "httplug"
    • Fixed compatibility with Twig 3.x
    Source code(tar.gz)
    Source code(zip)
  • 1.23.1(Oct 13, 2021)

    • Fix issue with whitespaces in URL when URL in tab was copied
    • Fixed dark mode compatiblity, making some previously invisible elements visible
    Source code(tar.gz)
    Source code(zip)
  • 1.23.0(Aug 30, 2021)

    • Changed the way request/response body is displayed in profiler. symfony/var-dumper is used now.
    • Changed badge counter of # of requests on side menu to be always visible
    Source code(tar.gz)
    Source code(zip)
  • 1.22.1(Jul 26, 2021)

    • Do not deprecate the service alias for the old Http\Client\HttpClient interface because different Symfony versions expect a different syntax for the deprecation, which triggers an error on some Symfony versions.
    Source code(tar.gz)
    Source code(zip)
  • 1.22.0(Jul 26, 2021)

    • Register client as alias for the PSR Psr\Http\Client\ClientInterface
    • Deprecate relying on the Http\Client\HttpClient interface in favor of the PSR ClientInterface
    Source code(tar.gz)
    Source code(zip)
  • 1.21.0(Jul 10, 2021)

  • 1.20.1(Feb 12, 2021)

  • 1.20.0(Dec 23, 2020)

  • 1.19.0(Oct 21, 2020)

    Changed

    • ConfiguredClientsStrategy no longer implements EventSubscriberInterface, this has been moved to ConfiguredClientsStrategyListener to avoid initializing the strategy on every request.
    Source code(tar.gz)
    Source code(zip)
  • 1.18.0(Mar 30, 2020)

  • 1.17.0(Dec 27, 2019)

    Added

    • Support Symfony 5 and Twig 3.
    • Configured clients are now tagged with 'httplug.client'
    • Adds a link to profiler page when response is from a Symfony application with profiler enabled
    • Adding blacklisted_paths option of php-http/cache-plugin

    Changed

    • Fixed error handling. Now TypeErrors and other \Throwable are correctly handled by ProfileClient
    • Use tabular design in profiler for HTTP request/response headers

    Deprecated

    • httplug.collector.twig.http_message service
    • httplug_markup Twig function
    Source code(tar.gz)
    Source code(zip)
  • 1.16.0(Jun 5, 2019)

    Changed

    • Dropped support for PHP < 7.1
    • Dropped support for Symfony versions that do no longer receive bugfixes

    Added

    • Integration for VCR Plugin

    Fixed

    • Fix compatibility with curl-client 2.*. The CurlFactory now builds the client using PSR-17 factories. Marked a conflict for curl-client 1.*.
    Source code(tar.gz)
    Source code(zip)
  • 1.15.2(May 20, 2019)

  • 1.15.1(Apr 12, 2019)

  • 1.15.0(Mar 29, 2019)

    Added

    • Autowiring support for FlexibleClient, HttpMethodsClientInterface and BatchClientInterface if they are enabled on the default/first client. (Only available with Httplug 2)
    • Configuration for the content_type plugin
    • Support for namespaced Twig classes.
    • Configuration option default_client_autowiring that you can set to false to prevent autowiring the HttpClient and HttpAsyncClient

    Changed

    • Moved source code to src/ and tests to tests/
    • Removed twig/twig dependency
    • Removed hard dependency on php-http/cache-plugin. If you want to use the cache plugin, you need to require it in your project.
    • Allow to set httpplug.profiling.captured_body_length configuration to null to avoid body limitation size.

    Fixed

    • MockFactory now accepts any client, e.g. a mock client decorated with the plugin client for the development panel, so that configuring a mock client actually works. The MockFactory is now final.
    • Width of the HTTPlug icon in Profiler Toolbar.
    • RequestExceptionInterface formatting (getResponse() is not called anymore).
    Source code(tar.gz)
    Source code(zip)
  • 1.14.0(Jan 3, 2019)

  • 1.13.1(Nov 28, 2018)

  • 1.13.0(Nov 13, 2018)

  • 1.12.0(Oct 26, 2018)

  • 1.11.0(Jul 7, 2018)

  • 1.10.0(Mar 27, 2018)

  • 1.9.0(Mar 6, 2018)

  • 1.8.1(Dec 6, 2017)

  • 1.8.0(Nov 30, 2017)

  • v1.7.1(Aug 5, 2017)

Owner
The PHP HTTP group
Collection of HTTP related packages. Our main product: HTTPlug
The PHP HTTP group
Sanitize untrustworthy HTML user input (Symfony integration for https://github.com/tgalopin/html-sanitizer)

html-sanitizer is a library aiming at handling, cleaning and sanitizing HTML sent by external users (who you cannot trust), allowing you to store it and display it safely. It has sensible defaults to provide a great developer experience while still being entierely configurable.

Titouan Galopin 86 Oct 5, 2022
AccessibleBundle provides an Accessible integration for your Symfony projects

AccessibleBundle AccessibleBundle provides an Accessible integration for your Symfony projects. This will allow you to define your class behavior usin

Antares Tupin 13 Apr 2, 2022
Simple php-imap integration for Symfony 2.8, 3.x and 4.x.

PHP-IMAP integration bundle Simple php-imap integration for Symfony 4.x, 5.x and 6.x. The version 1.5 and above are only compatible with Symfony 4+. P

null 52 Dec 20, 2022
MeteionBundle is the Symfony integration of the Meteion library.

MeteionBundle MeteionBundle is a Symfony integration of the Meteion library. Key features Auto-configuration Commands Services Entities Installation c

Hiero 1 May 3, 2022
Integration with your Symfony app & Stimulus!

StimulusBundle: Symfony integration with Stimulus! This bundle adds integration between Symfony, Stimulus and Symfony UX: A) Twig stimulus_* functions

Symfony 12 Jun 12, 2023
Simple Symfony API-Platform Template which you can use to start to develop with symfony and api-platform

symfony-api-platform-skeleton Simple Template for Symfony API You can fork it and change the git remote to your Repo git remote set-url <your-git-remo

null 1 Jan 23, 2022
Dockerise Symfony Application (Symfony 6 + Clean Architecture+ DDD+ CQRS + Docker + Xdebug + PHPUnit + Doctrine ORM + JWT Auth + Static analysis)

Symfony Dockerise Symfony Application Install Docker Install Docker Compose Docker PHP & Nginx Create Symfony Application Debugging Install Xdebug Con

null 48 Jan 5, 2023
Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitweb, Cgit, Subversion, Mercurial and more

Source control integration plugin framework for MantisBT, including support for Github, Gitlab, Bitbucket, Gitweb, Cgit, Subversion, Mercurial and more

MantisBT Community Plugins 175 Sep 3, 2022
Iranian wallet provider's integration component for Laravel Framework

Iranian Wallets Integration Component For Laravel Iranian Wallet provider integration handler for Laravel 8.1+ known as LaraWallet component completel

PHP Monsters 11 Dec 26, 2022
🕧 Provides an scheduler bundle for symfony framework.

?? PHP Scheduler Bundle Provides the integration of the PHP Scheduler library into Symfony Framework. Installation Run composer require flexic/schedul

FlexicSystems 3 Nov 15, 2022
A bot written in PHP which attempts to link IRC with SQL database, allowing for integration between platforms

Valeyard IRC-SQL-GateWay A bot written in PHP which attempts to link IRC with SQL database, allowing for integration between platforms. This bot is mo

Valerie Pond 10 Oct 6, 2022
Paddle.com API integration for Laravel with support for webhooks/events

Laravel Paddle This package provides an integration with Paddle.com for Laravel. Read the blogpost about the introduction of the package! Features Sup

Protone Media 179 Dec 16, 2022
the repository uses some of the code from php-meminfo to simplify integration

the repository uses some of the code from php-meminfo to simplify integration

Dmitriy Bulgar 1 Nov 18, 2021
Adds factory functions for WooCommerce to be used with wp-browser integration tests.

wp-browser-woocommerce This library simplifies testing of WooCommerce themes and plugins with wp-browser. Several Unit Test Factories are added that a

Level Level 12 Dec 29, 2022
Krayin Zoom Integration

1. Introduction: Krayin Zoom Integration. It packs in lots of demanding features that allows your business to scale in no time: Admin user can connect

Krayin CRM 2 Dec 15, 2021
QuickBooks Integration for PHP

QuickBooks PHP DevKit QuickBooks integration support for PHP 5.x+ The package you've downloaded contains code and documentation for connecting various

Keith Palmer 443 Dec 19, 2022
Paddle.com API integration for Laravel with support for webhooks/events

Laravel Paddle This package provides an integration with Paddle.com for Laravel. Read the blogpost about the introduction of the package! Features Sup

Protone Media 180 Jan 1, 2023
Laravel Integration for Switchover PHP SDK. Feature Toggle Management made easy.

Switchover Laravel Integration Switchover Switchover is a Software-As-A-Service for managing feature toggles (aka switches, flags or feature flips) in

Switchover 6 Nov 6, 2022
🧩 Laravel Query Builder integration for PhpStorm

Laravel Query Laravel + DataGrip = ♥️ This plugin provides database integration for Laravel query builder. Features Schemas, tables, views and columns

Ernestas Kvedaras 41 Dec 14, 2022