PHP code example of t3s / vars

1. Go to this page and download the library: Download t3s/vars library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

t3s / vars example snippets

yaml
vars:
  company: 'TYPO3 Association'
  street: 'Bahnhofstrasse 4'
  zip: '6340'
  city: 'Baar'
  country: 'Switzerland'
  email: '[email protected]'
  website: 'https://typo3.org'
  openingHours: 'Mo-Fr 08:00-17:00; Sa 09:00-12:00'
  linkedin: 'https://www.linkedin.com/company/typo3'
yaml
vars:
  openingHours: 'Mo-Fr 08:00-17:00; Sa 09:00-12:00; By appointment'
text
en.country = Germany; en.profession = Web developer; fr.country = Allemagne
html
<!-- single value (linked if configured) -->
<vars:get key="phone" />
<vars:get key="phone" link="0" />
<vars:get key="register" default="–" />
{vars:get(key: 'company')}

<!-- replace placeholders in any text -->
<vars:replace link="0">{data.header}</vars:replace>
{data.header -> vars:replace(link: 0)}
html
<vars:replace link="0">{header}</vars:replace>