All Projects → jbboehr → php-mustache

jbboehr / php-mustache

Licence: MIT license
Mustache PHP Extension

Programming Languages

C++
36643 projects - #6 most used programming language
PHP
23972 projects - #3 most used programming language
M4
1887 projects
Nix
1067 projects

Projects that are alternatives of or similar to php-mustache

Pihole Kubernetes
PiHole on kubernetes
Stars: ✭ 180 (+227.27%)
Mutual labels:  mustache
Stubble
Trimmed down {{mustache}} templates in .NET
Stars: ✭ 247 (+349.09%)
Mutual labels:  mustache
php-bencode
C++ PHP extension which can boost the process of encoding and decoding of Bencode.
Stars: ✭ 16 (-70.91%)
Mutual labels:  php-extension
Micromustache
Ⓜ An extremely fast and small sub-implementation of the {{mustache}} template engine for JavaScript
Stars: ✭ 186 (+238.18%)
Mutual labels:  mustache
Hydro Serving
MLOps Platform
Stars: ✭ 213 (+287.27%)
Mutual labels:  mustache
Statik
Multi-purpose static web site generator aimed at developers.
Stars: ✭ 249 (+352.73%)
Mutual labels:  mustache
Ramhorns
Fast Mustache template engine implementation in pure Rust.
Stars: ✭ 172 (+212.73%)
Mutual labels:  mustache
abap mustache
Mustache template engine for ABAP
Stars: ✭ 14 (-74.55%)
Mutual labels:  mustache
Chevron
A Python implementation of mustache
Stars: ✭ 223 (+305.45%)
Mutual labels:  mustache
VueXcode
Syntax highlighting for .Vue components and .mustache templates in Xcode
Stars: ✭ 25 (-54.55%)
Mutual labels:  mustache
Milk
Milk is Mustache in CoffeeScript -- great with your browser or NodeJS!
Stars: ✭ 192 (+249.09%)
Mutual labels:  mustache
Charts
Stars: ✭ 206 (+274.55%)
Mutual labels:  mustache
xray
X-Ray - PHP Engine compiler hook API (new)
Stars: ✭ 19 (-65.45%)
Mutual labels:  php-extension
Swagger Codegen Generators
Stars: ✭ 184 (+234.55%)
Mutual labels:  mustache
dssg
A static site generator with a different approach
Stars: ✭ 15 (-72.73%)
Mutual labels:  mustache
Inlets Pro
Secure TCP and HTTP tunnels that work anywhere
Stars: ✭ 179 (+225.45%)
Mutual labels:  mustache
Mustache
Mustache text templates for modern C++
Stars: ✭ 248 (+350.91%)
Mutual labels:  mustache
hesperides
Configuration management tool providing universal text file templating and properties editing through a REST API or a webapp (backend part)
Stars: ✭ 35 (-36.36%)
Mutual labels:  mustache
php-smartcrop-extension
smartcrop implementation in php extension
Stars: ✭ 17 (-69.09%)
Mutual labels:  php-extension
nanobox-engine-php
Engine for running PHP apps on Nanobox
Stars: ✭ 20 (-63.64%)
Mutual labels:  php-extension

php-mustache

GitHub Build Status Coverage Status Software License

C++ implementation of Mustache as a PHP extension.

Features

All features of Mustache are supported EXCEPT:

  • Whitespace rules. All whitespace is kept as it is in the input template.

Installation

Linux/OSX

Source

Prerequisite packages are:

  • PHP development headers and tools
  • gcc >= 4.4 | clang >= 3.x | vc >= 11
  • GNU make >= 3.81
  • automake
  • autoconf
  • libmustache
git clone git://github.com/jbboehr/php-mustache.git --recursive
cd php-mustache
phpize
./configure --enable-mustache
make
sudo make install

Add the extension to your php.ini:

echo extension=mustache.so | tee -a /path/to/your/php.ini

Fedora/RHEL/CentOS

RPM packages of the extension are available in Remi's repository.

Fedora (change 24 to match your Fedora version)

dnf install https://rpms.remirepo.net/fedora/remi-release-24.rpm
dnf install --enablerepo=remi php-pecl-mustache

RHEL/CentOS (for default PHP in base repository)

yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install php-pecl-mustache

Nix/NixOS

nix-env -i -f https://github.com/jbboehr/php-mustache/archive/master.tar.gz

Windows

See Build your own PHP on Windows. You may need to add msinttypes (export) to your include directory.

Usage

Example:

<?php
$mustache = new Mustache();
$tmpl = <<<EOF
Hello {{name}}
You have just won {{value}} dollars!
{{#in_ca}}
Well, {{taxed_value}} dollars, after taxes.
{{/in_ca}}
EOF;
$data = array(
  'name' => 'John',
  'value' => 10000,
  'taxed_value' => 10000 * 0.6,
  'in_ca' => true,
);
$partials = array();
echo $mustache->render($tmpl, $data, $partials);

Produces:

Hello John
You have just won 10000 dollars!

Well, 6000 dollars, after taxes.

See also: template loader example

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].