---
title: "Custom data handlers"
manual: "External Import"
version: "main"
permalink: "https://docs.typo3.org/permalink/cobweb/external_import:developer-handlers@main"
source: "Developer/CustomHandlers/Index.rst"
rendered: "2026-10-17T19:10:20+00:00"
---

# Custom data handlers {#developer-handlers}

It is possible to use a custom data handler instead of the standard
`CobwebExternalImportImporter::handleArray()` and
`CobwebExternalImportImporter::handleXML()`. The value declared
as a custom data handler is a class name:

```php
$GLOBALS['TCA']['some_table']['external']['general'][0]['data'] = Foo\MyExtension\DataHandler\CustomDataHandler::class;
```

The class itself **must** implement the
`\Cobweb\ExternalImport\DataHandlerInterface` interface, which contains only
the `handleData()` method. This method will receive two
arguments:

-   an array containing the raw data returned by the connector service
-   a reference to the calling `\Cobweb\ExternalImport\Importer` object

The method is expected to return a simple PHP array, with indexed
entries, like the standard methods (`CobwebExternalImportImporter::handleArray()` and
`CobwebExternalImportImporter::handleXML()`).

> [!NOTE]
> This was not tested by myself (the extension author). It
> was introduced to answer the particular need to parse large arrays
> using methods similar to XPath. This would have relied on a library
> which was not considered stable enough. Having custom data handlers
> makes it possible.
