Download the PHP package jbboehr/php-mustache without Composer
On this page you can find all versions of the php package jbboehr/php-mustache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jbboehr/php-mustache
More information about jbboehr/php-mustache
Files in jbboehr/php-mustache
Package php-mustache
Short Description Mustache templating language extension for PHP
License MIT
Homepage https://github.com/jbboehr/php-mustache
Informations about the package php-mustache
php-mustache
C++ implementation of Mustache as a PHP extension.
Upgrading from 0.9.x? Read the migration guide before updating.
Installation
PIE
PIE requires PHP 8.1 or newer to run, but it can install the extension for PHP 8.0:
For releases with matching binary assets, PIE downloads the extension with libmustache linked statically. These packages target Windows x64 with PHP 8.0–8.5 and macOS 15 or newer on Apple Silicon with PHP 8.2–8.5, in both thread-safe and non-thread-safe modes. Check the release assets for availability.
On Windows, PIE requires a matching binary; it cannot compile the extension. Other Windows architectures and PHP builds are unsupported by these packages.
On Unix systems, including macOS, PIE builds from source when no matching binary is available. Install the source requirements, including libmustache 0.6.0 or newer. For source builds with libmustache under a non-standard prefix, pass it explicitly. This option selects a source build on Unix even when a matching binary is available:
Source
Requirements:
- PHP 8.0 or newer, including the development headers and tools
- A C++17 compiler
- GNU Make, Automake, Autoconf, and Libtool
pkg-configlibmustache0.6.0 or newer
If libmustache is installed under a non-standard prefix, pass
--with-libmustache=/path/to/prefix to configure.
Add the extension to php.ini:
Nix
Use the flake package to build a PHP environment with the extension enabled:
The default package uses PHP 8.3. Replace default with a matrix package such
as php85-gcc to select another PHP version.
Windows
PIE installation requires a matching DLL ZIP in the selected release; it cannot fall back to compiling on Windows. The binary includes libmustache, so no separate libmustache installation is needed.
For source builds, install the PHP SDK and matching Visual C++ toolset. Download
a static libmustache SDK
matching PHP's architecture and toolset, and pass its extracted directory as
--with-libmustache=C:\path\to\libmustache. Use v142 for PHP 8.0–8.3 and v143
for PHP 8.4–8.5. Both TS and NTS builds use the SDK's /MD runtime variant.
Usage
Example:
Produces:
See the official Mustache manual for template syntax, the PHP API guide for data conversion, lambdas, errors, and limits, and the template loader example for loading templates from files.
MustacheData and MustacheLambdaHelper are final classes and cannot be
subclassed. To add application behavior around converted data, store a
MustacheData instance in your own class and pass the stored MustacheData
instance to Mustache::render(). The extension supplies MustacheLambdaHelper
to section lambdas; use the helper only during its callback.
PHP also rejects ReflectionClass::newInstanceWithoutConstructor() for these
two classes.
Mustache, MustacheTemplate, and MustacheAST remain extensible. The
PHP stub describes their public methods and types.
License
The MIT License (MIT). Please see License File for more information.