2017 © Pedro PelĂĄez
 

library puke

Lambda-based template system for PHP

image

habanero/puke

Lambda-based template system for PHP

  • Saturday, December 29, 2012
  • by pateketrueke
  • Repository
  • 1 Watchers
  • 0 Stars
  • 116 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

I did mean coupé

Many years ago CoffeeKup was born, we have lots of template engines now., (*1)

Well, I made this just for the "why not?" and inspired by the Markaby pattern, actually less sexy on PHP., (*2)

Of course, shall be installed as dependency using the Composer., (*3)

Basic usage

Display your favorite books., (*4)

<?php

require 'vendor/autoload.php';

$data = [
  [
    'author' => 'Hernando de Soto',
    'title' => 'The Mystery of Capitalism'
  ],
  [
    'author' => 'Henry Hazlitt',
    'title' => 'Economics in One Lesson'
  ],
  [
    'author' => 'Milton Friedman',
    'title' => 'Free to Choose'
  ],
];

# painless
$view = function () {
  if ($books) {
    table(function () {
      tr(function () {
        th('Author');
        th('Title');
      });
      foreach ($books as $key => $val) {
        tr(function () {
          td($val['author']);
          td($val['title']);
        });
      }
    });
  } else {
    p('There are no books to display.');
  }
};

# or using a clean render() helper...
echo Puke\Base::render($view, ['books' => $data]);

# now try this
p('funny');

Note that a simple echo will not work as normally, use the text() helper inside the template to achieve the same result., (*5)

Eval is evil but seriously here he is the king., (*6)

Finally

There is not much to say, if you want contribute you're welcome buddy., (*7)

The Versions

29/12 2012

dev-master

9999999-dev

Lambda-based template system for PHP

  Sources   Download

The Requires

  • php >=5.3

 

by Alvaro Cabrera

29/12 2012

v0.2

0.2.0.0

Lambda-based template system for PHP

  Sources   Download

The Requires

  • php >=5.3

 

by Alvaro Cabrera