Download the PHP package mintyphp/template without Composer

On this page you can find all versions of the php package mintyphp/template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package template

MintyPHP Template

Simple yet powerful Jinja-like templating system for HTML written in PHP.

See: https://www.tqdev.com/2026-jinja-templating-engine-html-php/

Overview

MintyPHP's Template engine provides a simple yet powerful Jinja-like templating system with variable interpolation, control structures, filters, and expression evaluation. Templates are HTML-safe by default with automatic escaping.

Requirements

Installation

Add a dependency with Composer:

Usage

BNF Syntax

Operators

Arithmetic Operators

Comparison Operators

Logical Operators

Operator Precedence (highest to lowest)

  1. not (unary)
  2. *, /, %
  3. +, -
  4. <, >, <=, >=
  5. ==, !=
  6. and, &&
  7. or, ||

Features


Examples

Example 1: Basic Variable Interpolation

Data (JSON):

Template:

Output:


Example 2: HTML Escaping

Data (JSON):

Template:

Output:


Example 3: Conditional Rendering

Data (JSON):

Template:

Output:


Example 4: If-ElseIf-Else Chain

Data (JSON):

Template:

Output:


Example 5: For Loops with Arrays

Data (JSON):

Template:

Output:


Example 6: For Loops with Key-Value Pairs

Data (JSON):

Template:

Output:


Example 7: Nested For Loops

Data (JSON):

Template:

Output:


Example 8: Nested Data Access

Data (JSON):

Template:

Output:


Example 9: Expressions in Variables

Data (JSON):

Template:

Output:


Example 10: String Concatenation

Data (JSON):

Template:

Output:


Example 11: Complex Conditions

Data (JSON):

Template:

Output:


Example 12: For Loop with Conditionals

Data (JSON):

Template:

Output:


Example 13: Comments

Data (JSON):

Template:

Output:


Example 14: Blog Post List

Data (JSON):

Template:

Output:


Example 15: Dashboard with Statistics

Data (JSON):

Template:

Output:


Template Inheritance

MintyPHP's template engine supports template inheritance through {% extends %} and {% block %} directives, allowing you to create reusable base templates.

Example: Base Template

base.html:

Example: Child Template

page.html:

Notes:


Template Inclusion

Use {% include %} to insert another template at a specific point.

Example: Including Templates

header.html:

main.html:

Notes:


Builtin Filters

MintyPHP includes comprehensive builtin filters for common transformations.

String Filters

lower

Convert to lowercase.

upper

Convert to uppercase.

capitalize

Capitalize first character.

title

Title case (capitalize each word).

trim

Remove leading/trailing whitespace.

truncate(length, end)

Truncate string to length (default 255, default end "...") without breaking words.

replace(old, new, count)

Replace substring occurrences.

split(separator)

Split string into array.

urlencode

URL-encode a string.

reverse

Reverse string or array.

Numeric Filters

abs

Absolute value.

round(precision, method)

Round number (default precision=0, method="common"). Available methods: common, ceil, floor, down, even/banker, odd, awayzero, tozero.

sprintf(format)

Format with sprintf.

filesizeformat(binary)

Format bytes as human-readable size.

Array/Collection Filters

length / count

Get count of items or string length.

first(n)

Get first item or first n items.

last(n)

Get last item or last n items.

join(separator, attribute)

Join array elements with separator.

sum(attribute)

Sum numeric values in array.

Utility Filters

default(value, boolean)

Return default if value is null (or falsy with boolean=true).

attr(name)

Get attribute by name.

debug / d

Pretty-print value as JSON for debugging.

raw

Output unescaped HTML (builtin).


Builtin Tests

Tests allow you to check properties of values using the is keyword in expressions.

Syntax

Available Tests

defined

Check if variable is defined.

undefined

Check if variable is undefined.

null

Check if value is null.

even

Check if number is even.

odd

Check if number is odd.

divisibleby(n)

Check if number is divisible by n.

number

Check if value is numeric.

string

Check if value is a string.

iterable

Check if value can be iterated.

Test Negation

Use is not to negate tests:


Custom Filters

Custom filters can be provided to the Template constructor.

PHP Usage Example:


Custom Tests

Custom tests can be provided as the third argument to the Template constructor.

PHP Usage Example:


Notes

Template Inheritance Notes

Configuration Example


All versions of template with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mintyphp/template contains the following files

Loading the files please wait ...