diff -u b/src/EventSubscriber/CsvSubscriber.php /dev/null
--- b/src/EventSubscriber/CsvSubscriber.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-
-namespace Drupal\csv_serialization\EventSubscriber;
-
-use Symfony\Component\HttpKernel\Event\RequestEvent;
-use Symfony\Component\HttpKernel\KernelEvents;
-use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-
-/**
- * Event subscriber for adding CSV content types to the request.
- */
-class CsvSubscriber implements EventSubscriberInterface {
-
-  /**
-   * Register content type formats on the request object.
-   *
-   * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
-   *   The Event to process.
-   */
-  public function onKernelRequest(RequestEvent $event) {
-    $event->getRequest()->setFormat('csv', ['text/csv']);
-  }
-
-  /**
-   * Implements \Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents().
-   */
-  public static function getSubscribedEvents() {
-    $events[KernelEvents::REQUEST][] = ['onKernelRequest', 33];
-    return $events;
-  }
-
-}
only in patch2:
unchanged:
--- a/csv_serialization.services.yml
+++ b/csv_serialization.services.yml
@@ -3,7 +3,3 @@ services:
     class: Drupal\csv_serialization\Encoder\CsvEncoder
     tags:
       - { name: encoder, format: csv }
-  csv_serialization.csvsubscriber:
-    class: Drupal\csv_serialization\EventSubscriber\CsvSubscriber
-    tags:
-      - { name: event_subscriber }
only in patch2:
unchanged:
--- /dev/null
+++ b/src/CsvSerializationServiceProvider.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Drupal\csv_serialization;
+
+use Drupal\Core\DependencyInjection\ContainerBuilder;
+use Drupal\Core\DependencyInjection\ServiceModifierInterface;
+
+/**
+ * Adds 'csv' as known format.
+ */
+class CsvSerializationServiceProvider implements ServiceModifierInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function alter(ContainerBuilder $container) {
+    if ($container->has('http_middleware.negotiation') && is_a($container->getDefinition('http_middleware.negotiation')->getClass(), '\Drupal\Core\StackMiddleware\NegotiationMiddleware', TRUE)) {
+      $container->getDefinition('http_middleware.negotiation')->addMethodCall('registerFormat', ['csv', ['text/csv']]);
+    }
+  }
+
+}
