Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 835 Bytes

extension-points.md

File metadata and controls

38 lines (31 loc) · 835 Bytes

Extension points

RequestEvent

Fired just after any http client's request.

Accessible properties:

  • getMicroservice(): Microservice: the microservice targeted by the request.
  • getMethod(): string: the request HTTP method.
  • getUri(): string: the request URI.
  • getOptions(): array: the options used for the request.

Example:

<?php

namespace App\EventListener;

use Mtarld\ApiPlatformMsBundle\Event\RequestEvent;

class RequestDumper
{
    public function __invoke(RequestEvent $event): void
    {
        dump(sprintf(
            'Calling "%s" microservice: "%s %s".',
            $event->getMicroservice()->getName(),
            $event->getMethod(),
            $event->getUri(),
        ));
    }
}
services:
    App\EventListener\RequestDumper:
        tags: ['kernel.event_listener']