PHPackages                             faktore/fe-json-api-utilities - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. faktore/fe-json-api-utilities

ActiveTypo3-cms-extension[Utility &amp; Helpers](/categories/utility)

faktore/fe-json-api-utilities
=============================

Faktor E JSON Utilities

v1.5.0(2w ago)06.1k↓31.7%GPL-2.0+PHPPHP ^8.1

Since Sep 8Pushed 2w ago1 watchersCompare

[ Source](https://github.com/faktore-git/fe-json-api-utilities)[ Packagist](https://packagist.org/packages/faktore/fe-json-api-utilities)[ Docs](https://www.faktor-e.de/)[ RSS](/packages/faktore-fe-json-api-utilities/feed)WikiDiscussions production Synced 2d ago

READMEChangelog (4)Dependencies (2)Versions (8)Used By (0)

Faktor E JSON API Utilites package
==================================

[](#faktor-e-json-api-utilites-package)

Purpose
-------

[](#purpose)

This TYPO3 extension helps extension authors with setting up a simple JSON-based API. It provides some helper methods and classes that can:

- parse the JSON request data
- build, enrich and send a JSON response
- transform TYPO3-specific models and object storages into structured arrays

Motivation
----------

[](#motivation)

Several of our recent projects have demands for widgets and components implemented in a frontend framework such as Vue. To effectively utilize these frontend components, communication with a TYPO3 backend is usually done via JSON requests &amp; responses.

Since these are usually very isolated widgets that don't require a fully fledged (headless) API, extensions like TYPO3 headless or t3api are very impressive, but they would be overkill in our use context. Instead we decided to go with this lightweight, self-maintainable solution.

Compatibility
-------------

[](#compatibility)

Extension versionTYPO3PHP1.5.x12.4, 13.4, 14.x8.1 – 8.51.4.x12.4, 13.48.1 – 8.3Usage
-----

[](#usage)

### JSON Requests

[](#json-requests)

If you want to handle POST data from a request, create a new instance and make sure to use the `parseJsonBody()` and `getDecodedData()` methods. Usage is very basic - Example in an Extbase Controller context:

```
use Faktore\FeJsonApiUtilities\Utility\JsonRequestUtility;

class EventsJsonApiController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
    protected JsonRequestUtility $jsonRequestUtility;

    // constructor with dependency injection
    public function __construct(JsonRequestUtility $jsonRequestUtility)
    {
        $this->jsonRequestUtility = $jsonRequestUtility;
    }

    public function searchAction(): ResponseInterface
    {
        // initialize the request utility
        $this->jsonRequestUtility->initialize();

        // get JSON POST data and store it in an array
        $postData = $this->jsonRequestUtility->parseJsonBody()->getDecodedData();

        // ... implement your handling of data
    }
}

$postData = $this->jsonRequestUtility->parseJsonBody()->getDecodedData();
```

### JSON Responses

[](#json-responses)

Responses can be built with the JsonResponseUtility. You can add response data (in array format), keep track of errors and success status, all in this object.

```
use Faktore\FeJsonApiUtilities\Utility\JsonResponseUtility;

class EventsJsonApiController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
    protected JsonResponseUtility $jsonResponseUtility;

    // constructor with dependency injection
    public function __construct(JsonResponseUtility $jsonResponseUtility)
    {
        $this->jsonResponseUtility = $jsonResponseUtility;
    }

    public function searchAction(): ResponseInterface
    {
        // ... implement your handling of data

        // for example get events for a calendar using a repository
        // $events = $this->eventRepository->findByDemand($filterDemand);

        // convert your result to array first.
        // Implementing the convertToArray method will be your responsibility.
        // The ConvertUtilities provide a lot of useful functions to help with that.
        $events = $this->convertToArray($events);

        if ($events) {
            // assign data to the response
            $this->jsonResponseUtility->assignData('events', $output);
            // keep track of success status for the response
            $this->jsonResponseUtility->setSuccess(true);
        } else {
            // add an error
            $this->jsonResponseUtility->addError('no events found');
            // keep track of success status for the response
            $this->jsonResponseUtility->setSuccess(false);
        }

        // ... do more checks and validations to add errors if necessary.

        // Lastly, make sure to return a PSR-compliant response. The JsonResponse works just fine in Controller context.
        return $this->jsonResponse(
            $this->jsonResponseUtility->getOutput()
        )->withStatus(200);
    }
}
```

### Object &amp; Property conversion utilities

[](#object--property-conversion-utilities)

Here is where you have a ConvertUtility class that can do a lot of magic for you.

#### Flattening FAL objects or FAL Storages

[](#flattening-fal-objects-or-fal-storages)

Use `ConvertUtility::flattenFileStorage($imageFileStorage, $properties, $useAbsoluteUrl)`.

Note that in addition to the provided properties, every file in the storage will always yield the key 'publicUrl':

**New in 1.4.0**: Added a third optional parameter to flattenFileStorage. If true, the 'publicUrl' will be made absolute.

```
use Faktore\FeJsonApiUtilities\Utility\ConvertUtility;

// ...

$result = [
    'title' => $event->getTitle() ?? '',
    // get FAL storages flattened
    'images' => ConvertUtility::flattenFileStorage(
            $event->getImages(),
            ['title', 'description', 'alternative'],
            true
        ) ?? '',
];

/* will return:
 * [
 *   'title' => 'foo'
 *   'images' => [
 *     0 => [
 *       'title' => bar,
 *       'publicUrl' => 'https://my.domain.com/puppies.jpg'
 *   ]
 * ]
 */
```

#### Flattening object storages

[](#flattening-object-storages)

this will utilize the propertymapper to access gettable properties of an object

```
use Faktore\FeJsonApiUtilities\Utility\ConvertUtility;

// ...

$result = ConvertUtility::flattenObjectStorage(
            $this->getCategories(),
            ['title', 'uid']
        );

/* $result will contain:
 * [
 *   0 => [
 *     'title' => 'foo',
 *     'uid' => 1234,
 *   ],
 *   1 => [
 *     'title' => 'bar',
 *     'uid' => 5678,
 *   ]
 * ]
 */
```

#### Others

[](#others)

There are a few other utility methods for converting your extbase models to arrays. Feel free to explore!

Disclaimer
----------

[](#disclaimer)

This utility library is very limited in scope, and it does not provide anything close to a full API for you. Making use of it in a real-world TYPO3 application will still require some work on your processing of requests and responses.

**Important:** Use at your own risk. There may be bugs. Remember to handle matters of security in your own code.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance97

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~202 days

Recently: every ~253 days

Total

6

Last Release

15d ago

PHP version history (3 changes)1.3.0PHP &gt;= 8.1.0, &lt;= 8.2.99

v1.4.2PHP &gt;= 8.1.0, &lt;= 8.4.99

v1.5.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/79a2502779c424057772dea1dcc6e3ee5f0b75f794a60ba2b977d23aa300b6ec?d=identicon)[faktor-e](/maintainers/faktor-e)

---

Top Contributors

[![larsgoo](https://avatars.githubusercontent.com/u/36926021?v=4)](https://github.com/larsgoo "larsgoo (7 commits)")[![larsgoossens](https://avatars.githubusercontent.com/u/31618628?v=4)](https://github.com/larsgoossens "larsgoossens (4 commits)")[![fe-mohmand](https://avatars.githubusercontent.com/u/131554515?v=4)](https://github.com/fe-mohmand "fe-mohmand (3 commits)")[![garvinhicking](https://avatars.githubusercontent.com/u/273326?v=4)](https://github.com/garvinhicking "garvinhicking (2 commits)")

---

Tags

TYPO3 CMSFaktor E

### Embed Badge

![Health badge](/badges/faktore-fe-json-api-utilities/health.svg)

```
[![Health](https://phpackages.com/badges/faktore-fe-json-api-utilities/health.svg)](https://phpackages.com/packages/faktore-fe-json-api-utilities)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[derhansen/sf_event_mgt

Event management and registration - Configurable event management and registration extension based on ExtBase and Fluid

66338.4k10](/packages/derhansen-sf-event-mgt)[brotkrueml/schema

Embedding schema.org vocabulary - API and view helpers for schema.org markup

34653.7k16](/packages/brotkrueml-schema)[yoast-seo-for-typo3/yoast_seo

Yoast SEO for TYPO3

511.7M9](/packages/yoast-seo-for-typo3-yoast-seo)[jweiland/events2

Events 2 - Create single and recurring events

2166.7k3](/packages/jweiland-events2)[t3sbs/t3sbootstrap

Startup extension to use bootstrap 5 classes, components and more out of the box. Example and info: \[www.t3sbootstrap.de\](https://www.t3sbootstrap.de)

2416.4k](/packages/t3sbs-t3sbootstrap)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
