2017 © Pedro Peláez
 

library curty

Simple curly braces micro templating

image

schnittstabil/curty

Simple curly braces micro templating

  • Monday, May 29, 2017
  • by schnittstabil
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Schnittstabil\Curty Build Status Coverage Status Code Climate Scrutinizer Code Quality

SensioLabsInsight, (*1)

Simple curly braces micro templating., (*2)

Install

composer require schnittstabil/curty

Usage

// Context (variable lookup table)
$ctx = [
    'user' => [
        'login' => 'curt',
        'phone' => [
            'internal' => 1337,
        ],
    ],
    'unicorn' => '{user.login}: {user.phone.internal}',
    'lazy' => function ($ctx) : string {
        return date('z').' {unicorn}';
    },
];

/*
 * Simple rendering
 */
use Schnittstabil\Curty;

echo Curty\render('{user.login}', $ctx); // => 'curt'
echo Curty\render('{unicorn}', $ctx);    // => '{user.login}: {user.phone.internal}'
echo Curty\render('{lazy}', $ctx);       // => '42 {unicorn}'

/*
 * Fixed-point rendering
 */
use function Schnittstabil\curty;

echo curty('{user.login}', $ctx); // => 'curt'
echo curty('{unicorn}', $ctx);    // => 'curt: 1337'
echo curty('{lazy}', $ctx);       // => '42 curt: 1337'

License

MIT © schnittstabil, (*3)

The Versions

29/05 2017

dev-master

9999999-dev

Simple curly braces micro templating

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar schnittstabil

micro templating template simple transform string format formatting str values interpolation placeholders curly braces expand tpl fixed-point interpolate fixpoint fmt

29/05 2017

0.2.1

0.2.1.0

Simple curly braces micro templating

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar schnittstabil

micro templating template simple transform string format formatting str values interpolation placeholders curly braces expand tpl fixed-point interpolate fixpoint fmt

29/05 2017

0.2.0

0.2.0.0

Simple curly braces micro templating

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar schnittstabil

micro templating template simple transform string format formatting str values interpolation placeholders curly braces expand tpl fixed-point interpolate fixpoint fmt

29/05 2017

0.1.0

0.1.0.0

Simple curly braces micro templating

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar schnittstabil

micro templating template simple transform string format formatting str values interpolation placeholders curly braces expand tpl fixed-point interpolate fixpoint fmt