alanpoulain / api-platform-events-bundle
Makes API Platform send its own events
Installs: 4 245
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 1
Forks: 5
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.2
- api-platform/core: ^2.5
- symfony/event-dispatcher: ^4.0
Requires (Dev)
- edgedesign/phpqa: ^1.23
- friendsofphp/php-cs-fixer: ^2.15
- phpdocumentor/reflection-docblock: ^4.0.1
- phpstan/phpstan: ^0.11.19
- phpunit/phpunit: ^8.3
- sensiolabs/security-checker: ^6.0
- symfony/framework-bundle: ^4.0
- symfony/phpunit-bridge: ^4.3.4
- vimeo/psalm: ^3.6
This package is auto-updated.
Last update: 2024-11-29 05:33:32 UTC
README
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:
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.