Download the PHP package alanpoulain/api-platform-events-bundle without Composer
On this page you can find all versions of the php package alanpoulain/api-platform-events-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alanpoulain/api-platform-events-bundle
More information about alanpoulain/api-platform-events-bundle
Files in alanpoulain/api-platform-events-bundle
Package api-platform-events-bundle
Short Description Makes API Platform send its own events
License MIT
Informations about the package api-platform-events-bundle
API Platform Events Bundle
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:
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:
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:
Documentation
For an explanation of how it works, please read the documentation.
License
This package is available under the MIT license.