Download the PHP package bugo/antlers-php without Composer

On this page you can find all versions of the php package bugo/antlers-php. 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 antlers-php

Antlers PHP

PHP Coverage Status

A standalone implementation of the Antlers templating engine, designed for use outside the Statamic/Laravel ecosystem in any PHP 8.2+ project.

По-русски

Positioning

antlers-php targets a standalone Antlers subset for regular PHP projects.

This means the project aims to support the core Antlers language that works predictably without Statamic or Laravel, such as variables, expressions, conditions, loops, modifiers, partials, and custom tags/modifiers.

It does not promise full compatibility with every Statamic tag, modifier, CMS feature, or Laravel-dependent integration.

In particular, {{? ?}} and {{$ $}} PHP delimiters from Statamic Antlers are intentionally not supported in antlers-php. This project keeps PHP execution out of the standalone core instead of exposing it as a template feature.

Installation

Quick Start

Security

antlers-php does not auto-escape {{ ... }} output by default. This is intentional for standalone Antlers compatibility.

When rendering user-provided content into HTML, explicitly escape it with sanitize or entities:

Treat plain {{ ... }} output as raw template output unless you have applied the escaping yourself.

Syntax

Variables

items[key] uses the current scope variable key as the index. For a literal key, use dot notation: {{ items.key }}.

Null Coalescing and Ternary Operator

Arithmetic and Strings

Conditions

Loops

Variables available inside loops include:

Variable Description
{{ count }} Current iteration number (starting from 1)
{{ index }} Current iteration number (starting from 0)
{{ total }} Total number of items
{{ first }} true on the first iteration
{{ last }} true on the last iteration
{{ odd }} true on odd iterations
{{ even }} true on even iterations
{{ key }} Key of the current item

Paired array loops also support neighbor access via colon notation:

Modifiers

Setting Variables

Comments

{{? ?}} and {{$ $}} are not available in this engine. If you need PHP, keep it outside Antlers templates in your application code.

Noparse

Tags

Built-in Tags

The standalone core currently registers these built-in tags:

dump, foreach, increment, layout, loop, markdown, once, partial, prepend, push, scope, section, slot, stack, svg, switch, yield

set is also supported as Antlers syntax for variable assignment, but it is language syntax rather than a registered tag from CoreTags.

Core Tag Examples

Built-in Modifiers

This project intentionally supports an official subset of Statamic modifiers that works well in a standalone PHP engine, without Laravel/Statamic runtime dependencies.

Status Modifiers
Supported official subset add, ceil, chunk, contains, count, decode, divide, ends_with, entities, explode, first, flatten, floor, format, is_array, is_empty, is_numeric, join, kebab, keys, last, lcfirst, length, limit, lower, markdown, md5, mod, multiply, nl2br, pad, pluck, regex_replace, repeat, replace, reverse, round, sanitize, slugify, snake, sort, starts_with, strip_tags, studly, subtract, surround, title, trim, truncate, ucfirst, unique, upper, values, where, word_count, wrap

Disputed Statamic Modifiers

antlers, partial, and raw are intentionally excluded from the standalone modifier API.

String | Modifier | Description | Example | |----------|-------------|---------| | `upper` | Uppercase | `{{ name \| upper }}` | | `lower` | Lowercase | `{{ name \| lower }}` | | `title` | Title Case | `{{ title \| title }}` | | `ucfirst` | Capitalize the first character | `{{ text \| ucfirst }}` | | `lcfirst` | Lowercase the first character | `{{ text \| lcfirst }}` | | `slugify` | URL slug | `{{ title \| slugify }}` | | `snake` | snake_case | `{{ name \| snake }}` | | `studly` | StudlyCase | `{{ name \| studly }}` | | `kebab` | kebab-case | `{{ name \| kebab }}` | | `trim` | Trim whitespace | `{{ text \| trim }}` | | `truncate` | Truncate to N characters | `{{ text \| truncate:100:"..." }}` | | `limit` | Limit length | `{{ text \| limit:50 }}` | | `word_count` | Count words | `{{ text \| word_count }}` | | `replace` | Replace substring | `{{ text \| replace:"old":"new" }}` | | `regex_replace` | Replace using a regex pattern | `{{ text \| regex_replace:"/old/":"new" }}` | | `nl2br` | Line breaks → `
` | `{{ text \| nl2br }}` | | `strip_tags` | Remove HTML tags | `{{ html \| strip_tags }}` | | `entities` / `sanitize` | Escape HTML | `{{ input \| entities }}` | | `decode` | Decode HTML entities | `{{ input \| decode }}` | | `markdown` | Parse Markdown | `{{ content \| markdown }}` | | `wrap` | Wrap in an HTML tag | `{{ text \| wrap:"span" }}` | | `surround` | Add text before/after | `{{ text \| surround:"[":"]" }}` | | `repeat` | Repeat string | `{{ text \| repeat:3 }}` | | `starts_with` | Starts with | `{{ text \| starts_with:"Hello" }}` | | `ends_with` | Ends with | `{{ text \| ends_with:"!" }}` | | `contains` | Contains substring | `{{ text \| contains:"word" }}` | | `length` | String length | `{{ text \| length }}` |
Numeric | Modifier | Description | Example | |----------|-------------|---------| | `add` | Add | `{{ price \| add:10 }}` | | `subtract` | Subtract | `{{ price \| subtract:5 }}` | | `multiply` | Multiply | `{{ price \| multiply:1.2 }}` | | `divide` | Divide | `{{ total \| divide:100 }}` | | `mod` | Modulo | `{{ n \| mod:2 }}` | | `ceil` | Round up | `{{ value \| ceil }}` | | `floor` | Round down | `{{ value \| floor }}` | | `round` | Round | `{{ value \| round:2 }}` |
Array | Modifier | Description | Example | |----------|-------------|---------| | `sort` | Sort | `{{ items \| sort:"name" }}` | | `reverse` | Reverse | `{{ items \| reverse }}` | | `first` | First element | `{{ items \| first }}` | | `last` | Last element | `{{ items \| last }}` | | `pluck` | Extract a field | `{{ users \| pluck:"name" }}` | | `unique` | Unique values | `{{ tags \| unique }}` | | `where` | Filter by field | `{{ items \| where:"status":"active" }}` | | `chunk` | Split into groups | `{{ items \| chunk:3 }}` | | `keys` | Array keys | `{{ data \| keys }}` | | `values` | Array values | `{{ data \| values }}` | | `count` | Number of items | `{{ items \| count }}` | | `join` | Join into a string | `{{ tags \| join:", " }}` | | `explode` | Split a string | `{{ csv \| explode:"," }}` |
Date and Time | Modifier | Description | Example | |----------|-------------|---------| | `format` | Format a date | `{{ date \| format:"d.m.Y" }}` | Current standalone strategy: - The built-in date/time surface is intentionally minimal and currently limited to `format`. - `format` accepts Unix timestamps and strings that PHP can parse via `strtotime()`. - If parsing fails, the original string is returned unchanged. - Carbon is intentionally not a dependency of this project. - Carbon-style or locale-aware modifiers such as `iso_format`, `modify_date`, `days_ago`, `is_today`, or `timezone` are not part of the first stable standalone core. - If richer date/time support is added later, it should be built on native PHP types such as `DateTimeImmutable`, `DateTimeInterface`, and `DateTimeZone`, preferably as an opt-in extension.
Utilities | Modifier | Description | Example | |----------|-------------|---------| | `is_empty` | Check if empty | `{{ items \| is_empty }}` | | `is_array` | Check if value is an array | `{{ items \| is_array }}` | | `is_numeric` | Check if value is numeric | `{{ value \| is_numeric }}` | | `md5` | MD5 hash | `{{ email \| md5 }}` |

Extending

Custom Modifier

Custom Tag

Built-in cache/nocache are not part of the required standalone core right now. If you need cache-like behavior, you can add it as a custom extension:

Paired Tag with Children

Global Variables

Strict Mode


All versions of antlers-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
symfony/string Version ^7.4|^8.0
symfony/translation-contracts Version ^3.6
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 bugo/antlers-php contains the following files

Loading the files please wait ...