Download the PHP package t3s/vars without Composer

On this page you can find all versions of the php package t3s/vars. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package vars

T3S Vars – Global variables for TYPO3 v14

Latest Stable Version Monthly Downloads Total Downloads License Donate

Version: 1.1.0 · Package: t3s/vars · Extension key: t3s_vars · Documentation: docs.typo3.org · Live demo: www.t3sbootstrap.de/extensions/globale-variablen

t3s_vars provides centrally maintained values such as company, address, phone or email as placeholders:

Requirements

TYPO3 14.3+
PHP 8.2+
RTE CKEditor 5 (rte_ckeditor)

Installation

Then add the site set "T3S Vars - Global variables" (t3s/vars) to your site:

Sites → Setup → Edit site → Sets, or in config/sites/<site>/config.yaml:

Flush caches:

Maintaining values

Sites → Setup → Edit settings → category Global variables. The values are stored in config/sites/<site>/settings.yaml:

Included variables

Placeholder Setting Link
{{company}} vars.company –
{{person}} vars.person –
{{profession}} vars.profession –
{{street}} vars.street –
{{addressAddition}} vars.addressAddition –
{{zip}} vars.zip –
{{city}} vars.city –
{{country}} vars.country –
{{phone}} vars.phone tel:
{{fax}} vars.fax tel:
{{email}} vars.email mailto:
{{website}} vars.website URL
{{vatId}} vars.vatId –
{{maps}} vars.maps – (used by the content element)
{{openingHours}} vars.openingHours – (localized, one period per line)
{{facebook}}, {{instagram}}, {{linkedin}}, {{xing}}, {{youtube}}, {{x}}, {{tiktok}}, {{mastodon}} vars.facebook … URL

Adding custom variables

In your own site set in settings.definitions.yaml – every key with the prefix vars. automatically becomes a placeholder and shows up in the RTE dropdown:

Nested keys are possible: vars.office.phone → {{office.phone}}.

Usage

In the RTE

Type the placeholder or insert it via the Variables dropdown in the toolbar. The dropdown only lists variables that have a value, each with its label and current value.

Notation Output
{{phone}} Link if configured as a link key, otherwise text
{{phone:text}} always plain text
{{unknown}} stays unchanged (typos are easy to spot)

Empty values are replaced by an empty string.

Controlling links

Category Variables: options in the site settings:

Setting Default Link
t3sVars.telKeys phone,fax tel: – spaces, hyphens etc. are removed from the href
t3sVars.mailKeys email mailto: – config.spamProtectEmailAddresses applies
t3sVars.urlKeys website and the social media keys URL – opens in a new tab (target="_blank" rel="noopener")

Simply add your own keys, e.g. phone,fax,mobile.

Website URLs: enter the full URL including https:// (e.g. https://typo3.org). If the scheme is missing, https:// is added automatically for the link; the link text is shown exactly as entered.

Every setting has a short help text with format and example in the backend (English and German).

Google Maps

Setting Category Content
vars.maps Global variables Share link of your Google Business profile (Google Maps → your business → Share → https://maps.app.goo.gl/…)
t3sVars.mapsEmbed Variables: options Embed URL for the map: Google Maps → Share → Embed a map → paste the src URL (https://www.google.com/maps/embed?pb=…) or the whole <iframe> code – share links do not work here
t3sVars.mapsConsent Variables: options Load the map only after a click (default: on)

Use the share link of your Business profile – not a plain address search – so the route button points to your verified listing. This links website and profile consistently (local SEO); together with identical NAP data (name, address, phone) on the website and in the profile it is a supporting signal, not a ranking guarantee.

Only http(s) URLs are accepted for both values.

Opening hours

vars.openingHours takes the periods in schema.org format, separated by ; (the settings editor shows a single-line field; line breaks in settings.yaml work as well):

Days: Mo Tu We Th Fr Sa Su, ranges with -, lists with , (Mo,We,Fr 09:00-12:00). In the frontend the periods are shown in the page language – "Mon–Fri 08:00–17:00" in English, "Mo–Fr 08:00–17:00 Uhr" in German. Entries in another format (e.g. "By appointment") are shown as text and left out of the structured data.

Social media

vars.facebook, vars.instagram, vars.linkedin, vars.xing, vars.youtube, vars.x, vars.tiktok, vars.mastodon (category Global variables: social media) take the full profile URL. The content element shows them as icon links (brand icons via EXT:iconpack, otherwise the name as text); JSON-LD lists them as sameAs. Only http(s) URLs are used.

Multilingual sites

Site settings apply to all languages of a site. Values that differ per language go into t3sVars.translations (category Variables: options), separated by ;:

The language code is the one of the site language (en for en_US.UTF-8). Translations apply to placeholders, ViewHelpers, the content element and JSON-LD – not to TypoScript constants and {site.settings.vars.*}. For opening hours separate the periods with |: en.openingHours = Mo-Fr 08:00-17:00 | By appointment. Day names are translated automatically, so opening hours usually need no translation.

JSON-LD (schema.org)

With t3sVars.jsonLd enabled, every page gets structured data in the <head> – name, URL, phone, fax, email, VAT ID, address, opening hours, map link and social profiles:

Setting Default
t3sVars.jsonLd off output JSON-LD (requires vars.company)
t3sVars.jsonLdType LocalBusiness schema.org type, e.g. Organization, ProfessionalService, Store, Restaurant, Dentist – also used for the microdata of the content element

The script is added before </head> via a PSR-14 event, so it works with PAGE and PAGEVIEW alike. Disable it if another extension already outputs LocalBusiness/Organization data. Check the result with Google's Rich Results Test.

In Fluid

The namespace vars is registered globally – no {namespace} declaration needed.

<vars:replace> escapes the content before replacing. A ViewHelper output inside (e.g. f:sanitize.html()) is not escaped twice.

Example: placeholders in headers

Placeholders are replaced automatically in RTE text – but headers are output directly by the template, without parseFunc. An editor entering the header

sees Welcome to {{company}} in the frontend. With vars:replace in the template that outputs the header, it becomes Welcome to TYPO3 Association.

Override the partial that outputs the header and wrap the output. With fluid_styled_content this is Partials/Header/Header.html – replace {header} with:

If your theme outputs headers in another partial, wrap the output there in the same way. Output that is already HTML (e.g. {header -> f:format.raw()}) can be wrapped as is – it is not escaped twice.

link="0" prevents nested links – headers are often linked themselves.

More examples

In PAGEVIEW templates the raw values are available directly:

In TypoScript

Site settings are automatically available as TypoScript constants. {$vars.…} works only in TypoScript (setup/constants of a site set) – not in Fluid and not in the RTE.

Useful wherever TypoScript itself outputs or sets a value:

Overview: which notation where

Where Notation
RTE / bodytext {{company}}
Fluid template <vars:get key="company" />
Headers etc. (override the header partial) <vars:replace link="0">…</vars:replace> – see example above
PAGEVIEW template {site.settings.vars.company}
TypoScript {$vars.company}

If no TypoScript object needs the value, {$vars.…} is not required.

Content element "Address" (t3s_address)

In the new content element wizard under Default → Address (global variables). The data comes directly from the site settings, so changes there apply to all address elements at once (after flushing the cache).

Field Use
Layout Compact (address only), Compact (address & map), Split (contact + map) or Split (contact only, no map) – layouts with map need t3sVars.mapsEmbed (hint shown at the field)
Header / Subheader Split: heading and small label above it (e.g. "Contact")

Opening hours and social media links appear automatically below the contact details as soon as they are maintained.

Save contact (vCard): the contact details end with a link Save contact that downloads a .vcf file (name, company, profession, address, phone, fax, email, website, social profiles) for the address book on phone and computer. The file is embedded in the link as data URL – no extra request, no server route, cached with the page. Disable it with t3sVars.vcard: false.

Layout "Compact"

Output (empty values are omitted):

Layout "Compact (address & map)"

Same address block as Compact, the Google map below it (full width, min. 350px, rounded corners). Uses the same two-click privacy as Split. Without t3sVars.mapsEmbed it looks like Compact.

Layout "Split"

Two columns from 992px: left subheading, heading, NAP blocks (Headquarters, Direct contact) and the route button; right the Google map. Without t3sVars.mapsEmbed – or with the layout Split (contact only, no map) – the section is single-column.

Icons (EXT:iconpack + Font Awesome)

If EXT:iconpack with Font Awesome (fa5, fa6 or fa7) is installed, the content element shows icons instead of the labels "Phone:", "Fax:", "Email:", "Web:":

Variable Icon
phone mobile
fax fax
email envelope
website globe
maps (route link) map-marker-alt

Spacing

The address is built from blocks: profession + owner, company + address, contact entries (each on its own line), VAT ID. contact.css is loaded in all layouts; adjust the spacing per site:

Customizing the template

Templates: Address.fluid.html (Compact), AddressMap.fluid.html (Compact (address & map)), AddressSplit.fluid.html (Split). Shared partials: T3sVars/Address.fluid.html (address block), T3sVars/Parts.fluid.html (sections Identity, Postal, Contact, Vat – used by all layouts) and T3sVars/Map.fluid.html (map incl. two-click privacy).

Place your own templates/partials in your own extension and add the path with a higher index:

Available in the template:

Variable Content
{vars.<key>} raw value (escaped by Fluid)
{varsLinked.<key>} escaped and linked if configured – output with -> f:format.raw()
{varsConfig.mapsUrl} validated Business profile link
{varsConfig.mapsEmbed} validated embed URL
{varsConfig.mapsConsent} two-click privacy on/off
{varsConfig.vcard} {href, filename} of the vCard download or null
{varsConfig.schemaType} schema.org type for the microdata (t3sVars.jsonLdType)
{varsHours} opening hours: list of {spec, text} – spec is the schema.org value (empty for free text), text the localized display
{varsSocial} social profiles: {name, url, icon} per key
{varsIcons.<key>} icon markup (phone, fax, email, website, maps, openingHours) if EXT:iconpack + Font Awesome is available – output with -> f:format.raw()

This also lets you add custom variables, e.g. {vars.register}.

The DataProcessor T3S\T3sVars\DataProcessing\VariablesProcessor can also be used in other content elements or in PAGEVIEW:

RTE integration

An event listener (AfterPrepareConfigurationForEditorEvent) adds the plugin and button to every CKEditor 5 preset – no custom preset required.

Planned

Source and issues

Source code, bug reports and feature requests: github.com/t3solution/t3s_vars

License and author

GPL-2.0-or-later · Helmut Hackbarth · T3Solution


All versions of vars with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
typo3/cms-core Version ^14.3
typo3/cms-frontend Version ^14.3
typo3/cms-rte-ckeditor Version ^14.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package t3s/vars contains the following files

Loading the files please wait ...