Issue Feature Closed

#93642New InvokableEnhancer

Rune Piper 03/04/21, 07:59 updated 10/07/26, 19:45

Description

I was wondering if it is possible to create an InvokableEnhancer to reduce configuration overhead. E.g. for dynamic JSON files you have to create a PAGE cObject and add the mapping (pageNum => route name) to the site configuration. I think it would by easier by creating a new RouteEnhancer that will invoke a controller. The site configuration could look like this:

routeEnhancers:
  Invokables:
    type: Invokable
    extension: SomeNiceExtension
    routes:
      - {routePath: 'some-file.json', _controller: 'Foo'}
      - {routePath: 'another-file.json', _controller: 'Bar'}

You can then easily create a controller like the following:
class Foo
{
  public function __invoke(): ResponseInterface
  {
    return new JsonResponse($someJson);
  }
}

This would remove all the TypoScript and plugin configuration.

Reviews 1

History 8

  1. Daniel Siepmann commented <span data-processor="relativetime" data-value="2021-05-17T06:10:15+00:00" > 05/17/21, 06:10 </span>

    I like the idea, still we didn’t have the use case yet.
    It is possible to register your own Enhancer (https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Routing/ExtendingRouting.html#writing-custom-enhancers). One could build such an enhancer and provide it as an 3rd party extension and / or patch for TYPO3.

  2. Oliver Hader commented and changed status New Needs Feedback assigned to Oliver Hader Sprint Focus On Location Sprint <span data-processor="relativetime" data-value="2022-11-03T14:58:37+00:00" > 11/03/22, 14:58 </span>

    I like the idea, unfortunately it works a bit different in TYPO3. Maybe I’ve time next week to think about that further…

  3. Benni Mack commented <span data-processor="relativetime" data-value="2025-07-25T15:58:47+00:00" > 07/25/25, 15:58 </span>

    Hey Rune,

    did you continue on this path already? maybe we need something like this https://review.typo3.org/c/Packages/TYPO3.CMS/+/76662 that is not bound to a page?

  4. Rune Piper commented <span data-processor="relativetime" data-value="2025-07-29T11:34:05+00:00" > 07/29/25, 11:34 </span>

    Benni Mack wrote in #note-6:
    > Hey Rune,
    >
    > did you continue on this path already? maybe we need something like this https://review.typo3.org/c/Packages/TYPO3.CMS/+/76662 that is not bound to a page?

    I haven’t. We typically do it with static routes and a minimal PAGE object:

    20231004 = PAGE
    20231004 {
        typeNum = 20231004
    
        config.disableAllHeaderCode = 1
    
        10 < tt_content.somextension_someplugin.20
    }

    Not as clean but still pretty simple.

    Your linked patch (and feature description) looks promising. Personally I would close this issue if #89518 gets merged into core.

  5. Georg Ringer commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2026-10-07T19:45:32+00:00" > 10/07/26, 19:45 </span>

    closing in favor of #89518 but also because there was no progress