Extbase/Fluid vs Plain PHP in TYPO3 13 – How to Pick the Right Rendering Path
Decide between Extbase/Fluid MVC and plain PHP with TypoScript for TYPO3 13 extensions. Compare trade‑offs, constraints, and see a step‑by‑step implementation example.
12 Dec 2025, 16:19 UTC

Problem
When building a custom TYPO3 extension you immediately face a design decision: use the full Extbase/Fluid MVC stack, or write a lightweight PHP snippet that is called from TypoScript. The choice impacts maintainability, performance, testability, and future‑proofing of your code.
Decision
Choose Extbase/Fluid if you need a structured, reusable component with complex business logic, routing, and a clean separation of concerns. Opt for plain PHP with TypoScript when the feature is simple, static, or a one‑page widget that does not justify the overhead of a full MVC layer.
Constraints
- TYPO3 version: 13 LTS (PHP 8.2+).
- Extension size and complexity.
- Team familiarity with Extbase/Fluid.
- Performance requirements and caching strategy.
- Future maintenance and unit testing expectations.
Supported Options
| Approach | Architecture | Complexity | Performance | Maintainability | Caching | Typical Use Cases |
|---|---|---|---|---|---|---|
| Extbase/Fluid MVC | Model‑View‑Controller with routing, services, and DI | High – requires controller, repository, model, template | Moderate – framework overhead, but efficient when cached | High – clear boundaries, unit‑testable, reusable | Controller action cache, partial cache, page cache integration | Complex forms, multi‑step workflows, reusable plugins |
| Plain PHP + TypoScript | Direct PHP functions called from TS | Low – no MVC plumbing | High – minimal overhead, fast for static content | Medium – logic can bleed into presentation, harder to test | TypoScript page cache, partial cache via cObject | Simple widgets, static banners, one‑page snippets |
Trade‑Offs
- Extbase/Fluid:
- Pros: Strong separation of concerns, built‑in routing, DI, caching hooks, community support.
- Cons: Requires learning curve, more files, heavier startup.
- Plain PHP + TypoScript:
- Pros: Lightweight, quick to prototype, no extra routing.
- Cons: Business logic mixed with templates, limited unit testing, harder to refactor.
Concrete Implementation – Extbase Example
Generate skeleton:
typo3cms extension:generate --type extbase(run in the TYPO3 root). This createsClasses/Controller/HelloController.php,Resources/Private/Templates/Hello/Index.html, and routing configuration.Controller (app/Hello/Controller/HelloController.php):
namespace Vendor\Hello\Controller; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class HelloController extends ActionController { public function indexAction(): void { $this->view->assign('message', 'Hello from Extbase!'); } }Template (Resources/Private/Templates/Hello/Index.html):
<h1>{message}</h1>Routing (Configuration/Routes.yaml):
Hello: path: /hello controller: Vendor\Hello\Controller\HelloController action: indexEnable the plugin via
ext_localconf.phpif needed, clear all caches, and request/helloin the browser. In debug mode you should see the controller invoked and the string rendered.
Concrete Implementation – Plain PHP + TypoScript Example
Add a PHP function in
ext_localconf.php:$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_pagetree.php']['getTreeContent'][] = \ function () { return 'Hello from plain PHP!'; };Define a TypoScript constant and lib object (ext/setup.typoscript):
lib.myWidget = TEXT lib.myWidget.value = Hello from plain PHP!Include the TS in the page template or include it via
page.10:page.10 = TEXT page.10.value = <h1>{lib.myWidget}</h1>Clear caches and load the page. The heading should display the string. No controller is invoked.
Validation Checklist
- Run
typo3cms cache:flushafter each change. - Verify controller invocation by enabling
debuginLocalConfiguration.phpand checking the debug panel. - Inspect the rendered HTML in the browser’s inspector to confirm the expected output.
- For Extbase, run
vendor/bin/phpunitif you added tests; for plain PHP, use simple assertions in the function.
Summary
Use Extbase/Fluid when you need a maintainable, testable, and reusable component with complex logic. Stick to plain PHP + TypoScript for quick, lightweight widgets that do not justify a full MVC stack. Both approaches support caching, but Extbase offers more granular control. Always keep your TYPO3 version and PHP environment in mind, and validate changes by flushing caches and inspecting output.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.