---
title: "Clean Phone Numbers in TYPO3: Why We Built EXT:phone_number"
url: "https://b13.com/blog/clean-phone-numbers-in-typo3"
description: "TYPO3 stores phone numbers as tel: links, but doesn’t format them for output. Meet EXT:phone_number, a Fluid ViewHelper for clean, consistent numbers."
image: "https://b13.com/fileadmin/_processed_/3/4/csm_EXTphonenumber_Sharing_93e8e87199.png"
date: 2026-07-31
modified: 2026-08-10
lastUpdated: 2026-08-10
---

# Clean Phone Numbers in TYPO3: Why We Built EXT:phone_number

![A purple graphic featuring a smartphone icon with three horizontal bars, surrounded by illustrations of vintage telephones.](https://b13.com/fileadmin/_processed_/2/5/csm_EXTphonenumber_Headerbild_ecbf8debe0.webp)TYPO3’s link wizard has had a dedicated Phone link type for a while now, and used consistently it’s genuinely useful: editors store phone numbers as proper tel: links, so the linking itself is correct and reliable. You’ve done the hard part—getting everyone to enter their numbers the right way.

The catch is the frontend. Once the number is stored correctly, you still have to decide how it should actually look on the page—full international form, national form, following DIN 5008—and TYPO3 doesn’t format it for you. The same stored number might need to appear one way in your imprint and another way in the footer.

This is where our little extension phone\_number comes in. It does one thing: it takes the phone number an editor has already stored—as a tel: link or a raw string—and formats it for output in the frontend. In this post I’ll explain the problem it solves and how to use it.

 Why the Output Format Matters
-----------------------------

What visitors actually read is the number printed on the page, and that’s where consistency counts. A number shown three different ways across three pages chips away at the polish of an otherwise clean site.

International visitors expect a predictable format, and in Germany the DIN 5008 standard sets clear rules for how a number should be written. Depending on the context you might want the full international form (+49 711 3400810) in your imprint and the shorter national form (0711 3400810) in a footer—ideally from the exact same stored number, without touching the backend.

Doing that formatting by hand in every template doesn’t scale. Each one ends up with its own little bit of logic, and over time you get exactly the kind of wild growth we try to avoid: many slightly different solutions to the same problem.

Our Solution: A Small ViewHelper Powered by libphonenumber
----------------------------------------------------------

![A stylized smartphone icon with signal bars, set against a purple and orange gradient background.](https://b13.com/fileadmin/Blog/EXT_phone_numbers/sharing-ext-PhoneNumber-S-20260803-061023.png)

The idea behind phone\_number is deliberately narrow: one Fluid ViewHelper that takes a raw phone number or a tel: URI and formats it into a clean international or national number. One line in your template, consistent output everywhere.

Installation works as usual via Composer:

![A stylized smartphone icon with signal bars, set against a purple and orange gradient background.](https://b13.com/fileadmin/Blog/EXT_phone_numbers/sharing-ext-PhoneNumber-S-20260803-061023.png)

```
1<br></br>
```

```
composer req b13/phone-number<br></br>
```

Then register the namespace in your Fluid template:

```
1<br></br>2<br></br>3<br></br>4<br></br>
```

```
<html<br></br>  <span class="hljs-attribute">data-namespace-typo3-fluid</span>=<span class="hljs-string">"true"</span><br></br>  xmlns:<span class="hljs-attribute">phone</span>=<span class="hljs-string">"http://typo3.org/ns/B13/PhoneNumber/ViewHelpers"</span><br></br>><br></br>
```

From there it’s a one-liner. International format is the default:

```
1<br></br>
```

```
<phone:<span class="hljs-keyword">format</span> <span class="hljs-keyword">value</span>="tel:+497113400810" /><br></br>
```

Need the national format instead? Flip one argument:

```
1<br></br>
```

```
<phone:<span class="hljs-keyword">format</span> <span class="hljs-keyword">value</span>="tel:+497113400810" <span class="hljs-type">national</span>="1" /><br></br>
```

It’s not limited to German numbers, either. Pass a US number and libphonenumber formats it the American way:

```
1<br></br>
```

```
<phone:<span class="hljs-keyword">format</span> <span class="hljs-keyword">value</span>="tel:+12125550123" /><br></br>
```

Switch to `national="1"` and you get (212) 555–0123—the format US readers expect.

The country comes from the number itself: the +1 tells libphonenumber it’s a US number, so the right format follows automatically—independent of your site’s language. The defaultRegion argument (more on it below) only kicks in for numbers stored without a country code, telling the parser which country to assume.

And if a number is stored as a plain string rather than a `tel:` link, it normalizes that too:

```
1<br></br>
```

```
<phone:<span class="hljs-keyword">format</span> <span class="hljs-keyword">value</span>="+49 (0) 711 34008-10" /><br></br>
```

This is the case the extension is really built for: a field defined as TCA `type=link` with `allowedTypes=telephone`—the Phone link type from the wizard—hands you a tel: URI, and the ViewHelper turns it straight into clean output. The number an editor picks in the backend is the number your visitor sees, cleanly formatted, every time.

The Arguments, at a Glance
--------------------------

The ViewHelper keeps its options short and predictable:

- `value`—the phone number or `tel:` link to format. Required.
- `defaultRegion`—the region used to parse numbers that come without a country code. Defaults to DE, and it only matters for those bare numbers—so set it to your company’s home country rather than the site’s language (the English site of a French company still wants FR here).
- `national`—format the number in national style (0711 …) instead of international. Defaults to off.

Requirements
------------

EXT:phone\_number runs on PHP 8.1 and supports TYPO3 12, 13, and 14. It’s open source under GPL-2.0-or-later, and the number parsing is handled by libphonenumber-for-php-lite—so you get battle-tested formatting rules without pulling in a heavy dependency.

Conclusion
----------

Phone numbers are a small detail, but small details are what make a site feel finished. Instead of formatting them by hand in every template, EXT:phone\_number gives you one consistent, reusable way to do it: install the extension, register the namespace, add one ViewHelper, and your numbers just look right.

Documentation and source code are available on GitHub: <https://github.com/b13/phone-number>

**Got a tricky formatting case?**

Whether you’re cleaning up phone numbers across a large TYPO3 installation or fine-tuning the details on a single site, we’re happy to help. If you’d like support with EXT:phone\_number or your TYPO3 project in general, feel free to get in touch with us.

[Let’s connect](https://b13.com/lets-connect)

  [  previous article: T3ppy Gives TYPO3 a Friendly Face ](https://b13.com/blog/t3ppy-design-kit)