Coder Social home page Coder Social logo

requestcollectorbundle's Introduction

Request Collector Bundle

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

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.

It will help you to inspect, debug or process webhooks / api requests.

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).

Installation

composer require deuzu/request-collector-bundle

app/AppKernel.php

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

app/config/routing.yml

deuzu_request_collector:
    resource: .
    type: request_collector

app/config/config.yml

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.

Create Doctrine schema if needed

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

...or update it

$ 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

Configuration

app/config/config.yml

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: [email protected]
            persister:
                enabled: true

If you are using a different channel, add it to monolog configuration

app/config/config.yml

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 :

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

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.