Download the PHP package millancore/pesto without Composer
On this page you can find all versions of the php package millancore/pesto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pesto
Pesto
Modern PHP template engine that provides an intuitive and expressive way to build web application views. It offers a clean syntax using custom HTML attributes and supports advanced templating features like view composition, slots, conditional rendering, loops, and built-in security measures.
Pesto understands the context of {{ variables }}
and escapes them according to their scope to avoid
Cross-Site Scripting (XSS) issues.
Or, for greater clarity, use <template>, which will not be included in the final render.
Pesto templates support files with the .html or .php extension,
allowing you to integrate PHP code if needed.
- Installation & usage
- View Composition
- The
<template>Tag - Partials
- Slots
- Nested Views
- The
- Control Flow
- If Attribute
- Loop
- Inline
- Filters
- Chain Filters
- Filters with Arguments
- Add Filters
- Benchmarks
Installation & Usage
- PHP ^8.4
Pesto is available via Composer and is free of third-party dependencies
View Composition
Pesto makes it easy to reuse parts of your views
Template Tag
The <template> tag allows you to define php-* attributes
that will be evaluated but not the tag included in the final render.
<p php-if="$user->isAdmin()">Admin</p>--><p>Admin</p><template php-if="$user->isAdmin()">Admin</template>-->Admin
Partials & Slots
When working with views that are composed of other views, you can use partials and slots to avoid repetition.
Layout
View:
Nested Views
Pesto allows you to nest views, allowing you to reuse the same layout for multiple times in the same view.
Control Flow
Pesto provides two control flow directives: foreach and if, enough to build any kind of view.
If Attribute
The only rule importance for use php-elseif and php-else is the tag must be a sibling of the php-if tag.
php-ifphp-elseifphp-else
php-if allows you to conditionally render a block of code.
Loops
Pesto provides a simple way to loop over arrays or objects.
Inline
Pesto also allows you to use inline control flow directives.
Filters
Pesto provides a simple way to apply filters to variables using the pipe operator, you can define your own filters.
List of Filters
rawPrevents escaping of the variable.
String Filters
upperlowercapitalizetitletrimnl2brstrip_tagsslugjoin
Chain Filters
You can chain multiple filters together.
Filters with Arguments
To pass arguments to a filter, you can use the : operator.
Add Filters
Add filter to Pesto is very simple, you can create a class with public methods and add the AsFilter Attribute.
on Pesto factory pass the class to the filters option.
Benchmarks
Pesto includes benchmarks comparing performance against Blade and Twig across four scenarios: simple rendering, loops, conditionals, and partials.
Benchmarks are powered by PHPBench with 100 iterations, 10 revolutions, and 5 warmup iterations.
All versions of pesto with dependencies
ext-dom Version *
ext-libxml Version *