2017 © Pedro Peláez
 

symfony-bundle request-collector-bundle

HTTP request collector

image

deuzu/request-collector-bundle

HTTP request collector

  • Wednesday, November 1, 2017
  • by deuzu
  • Repository
  • 1 Watchers
  • 7 Stars
  • 26,203 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 5 Versions
  • 3 % Grown

The README.md

Request Collector Bundle

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

The request collector Symfony bundle collects HTTP requests from various internet services (webhooks, api) or local calls. It exposes an URL that will persist, log and / or mail the incomming requests. The collected HTTP requests contain headers, query string parameters , post/form parameters and the body / content of the request., (*2)

It will help you to inspect, debug or process webhooks / api requests., (*3)

You can also add a your own custom service which will be executed just after the collect process by tagging a Symfony service from your application (CF Extension)., (*4)

Installation

composer require deuzu/request-collector-bundle

app/AppKernel.php, (*5)

$bundles = array(
    // ...
    new Deuzu\RequestCollectorBundle\DeuzuRequestCollectorBundle(),
);

app/config/routing.yml, (*6)

deuzu_request_collector:
    resource: .
    type: request_collector

app/config/config.yml, (*7)

framework:
    # ...
    serializer: { enable_annotations: true }

deuzu_request_collector:
    collectors:
        default:
            route_path: /request-collector/collect

You need to configure one collector and its route_path. By default the collector only persists the request., (*8)

Create Doctrine schema if needed, (*9)

$ php app/console doctrine:database:create
$ php app/console doctrine:schema:create

...or update it, (*10)

$ php app/console doctrine:schema:update --force

You're done. To test it try to access a configured URL and then add /inspect at the end to see the persisted requests. Logs are located in the log folder and named by default request_collector.log, (*11)

Configuration

app/config/config.yml, (*12)

deuzu_request_collector:
    assets:
        bootstrap3_css: true # or bundles/your_app/css/bootstrap.min.css
        bootstrap3_js: true  # or bundles/your_app/js/bootstrap.min.js
        jquery: true         # or bundles/your_app/js/jquery.min.js
    collectors:
        default:
            route_path: /what/ever/you/want
        github:
            route_path: /github/webhook
            logger:
                enabled: true
                channel: github
            mailer:
                enabled: true
                email: florian.touya@gmail.com
            persister:
                enabled: true

If you are using a different channel, add it to monolog configuration, (*13)

app/config/config.yml, (*14)

monolog:
    channels: ['github']
    handlers:
        # ...
        github:
            type: stream
            path: '%kernel.logs_dir%/%kernel.environment%.github.log'
            level: debug
            channels: [github]

Extension

If you want to add your own custom service after the collect process all you have to do is to tag it like this :, (*15)

post_collect_handler.default:
    class: AppBundle\Service\CustomPostCollectHandler
    tags:
        - { name: request_collector.post_collect_handler, alias: collector_name }

Your custom service must implements Deuzu\RequestCollectorBundle\PostCollectHandler\PostCollectHandlerInterface, (*16)

TODO

  • contributing.md, pr_template.md
  • Menu with differents collectors
    • button to copy address which collects
    • Inspect all collector action
  • Improve templates
    • filters
  • Add translations (en only)

The Versions

14/05 2015

0.0.1

0.0.1.0

HTTP request collector

  Sources   Download

MIT

The Requires

 

collector webhook http request