PHP code example of timobakx / api-events-bundle

1. Go to this page and download the library: Download timobakx/api-events-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

timobakx / api-events-bundle example snippets


// config/bundles.php

return [
    // ...
    TimoBakx\ApiEventsBundle\ApiEventsBundle::class => ['all' => true],
];


declare(strict_types=1);

// src/EventListener/DoSomethingAfterWriting.php

namespace App\EventListener;

use Symfony\Component\HttpKernel\Event\ViewEvent;
use TimoBakx\ApiEventsBundle\ApiPlatformListeners\AfterWrite;

final class DoSomethingAfterWriting implements AfterWrite
{
    public function __invoke(ViewEvent $event): void
    {
        // Check for the correct object, method and/or operation name
    
        // Do something
    }
}