Skip to content

Kirby 4.2.0


Generates an <a> tag for a phone number

Html::tel(string $tel, array|string|null $text = null, array $attr = [ ]): string


Name Type Default Description
$tel * string The phone number
$text array|string|null null The optional text; if null, the phone number will be used as text
$attr array [ ] Additional attributes for the tag

Return type


Parent class

Kirby\Cms\Html inherited from Kirby\Toolkit\Html


The Html::link() method strips out any non-numeric characters in the provided phone number (except the plus sign for international phone numbers). This is done to ensure a safe and reliable behavior of the resulting link.

If you need to add parameters or formatting to the tel URI (according to RFC 3966), please use the Html::link() method that otherwise works the same:

Html::link('tel:+1-416-123-4567;ext=890', '+1 416-123-4567 ext. 890');