Get support for alanpoulain/ApiPlatformEventsBundle

If you're new to LTH, please see our FAQ for more information on what it is we do.

Support Options

Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:

View Open Issues

Take a look to see if anyone else has experienced the same issue as you and if they managed to solve it.

Open an Issue

Make sure to read any relevant guidelines for opening issues on this repo before posting a new issue.

Sponsor directly

Check out the page and see if there are any options to sponsor this project or it's developers directly.

alanpoulain/ApiPlatformEventsBundle

API Platform Events Bundle

Coverage Status GitHub Actions

Makes API Platform send its own events.

It supports only GraphQL (for now).

Please support the Stages RFC if you want a support for REST.

This bundle is useful if you really want to use events. The recommended way to add your logic is to decorate the stages.

With this bundle, the following events will be dispatched during a query or a mutation executed by API Platform:

Event Query Mutation
PreReadEvent sent ✔️️ sent ✔️
PostReadEvent sent ✔️ sent ✔️
PreDeserializeEvent not sent ❌ sent ✔️
PostDeserializeEvent not sent ❌ sent ✔️
PreValidateEvent not sent ❌ sent ✔️
PostValidateEvent not sent ❌ sent ✔️
PreWriteEvent not sent ❌ sent ✔️
PostWriteEvent not sent ❌ sent ✔️
PreSerializeEvent sent ✔️ sent ✔️
PostSerializeEvent sent ✔️ sent ✔️

By using Event Listeners, you can add your custom logic where you need.

In an event sent by this bundle, you have access to:

  • the related resource,
  • the operation name (get, delete, etc.),
  • the related data (if it makes sense),
  • the context (an array with some useful data).

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require alanpoulain/api-platform-events-bundle

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require alanpoulain/api-platform-events-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    ApiPlatform\EventsBundle\ApiPlatformEventsBundle::class => ['all' => true],
];

Documentation

For an explanation of how it works, please read the documentation.

License

This package is available under the MIT license.

Our Mission

We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.

Interesting Articles

Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated

p-e622a1a2