Download the PHP package spreadable/template without Composer
On this page you can find all versions of the php package spreadable/template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spreadable/template
More information about spreadable/template
Files in spreadable/template
Package template
Short Description A composition-oriented template engine, written in PHP.
License MIT
Homepage https://github.com/spreadable/template
Informations about the package template
spreadable/template
A composition-oriented template engine, written in PHP.
Install
composer install spreadable/template
The markers
There is 2 types of markers:
{user.name}: a marker for required data{?user.name}: a marker for optional data
Special meaning of a unique optional marker on an attribute
An attribute contains a unique optional marker and if the provided
value is null, on the rendering, that attribute is simply removed,
useful for boolean attributes.
Basic templates
Build an entire page
Prefilling
Added in 1.1.0
Sometimes, it can be interesting to prefill some fragments to avoid making the entire filling job during the runtime.
For that reason, you can call $fragment->serialize(string $prefix = null) with a prefix matching the first marker segment.
You can now save them as files to be able to reuse them to only fill the rest during the runtime.
Mapping
Added in 1.2.0
A fragment has a $fragment->map(array $datas, callable $callback = null) which calls the fragment on each entry.
Instead, if a $callback is provided, the fragment is called on the result of $callback($datas_entry_value, $datas_entry_key, $datas)
License
MIT
All versions of template with dependencies
ext-dom Version *
ext-libxml Version *