Download the PHP package nabeghe/risma without Composer
On this page you can find all versions of the php package nabeghe/risma. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nabeghe/risma
More information about nabeghe/risma
Files in nabeghe/risma
Package risma
Short Description A lightweight, zero-dependency string template engine and interpreter for PHP โ embed logic, conditionals, and function pipelines directly inside strings.
License MIT
Homepage https://github.com/nabeghe/risma-php
Informations about the package risma
โก Risma
A Lightweight String Template Engine & Interpreter for PHP
๐ฎ What is Risma?
The logic lives inside the string itself.
Risma is a zero-dependency PHP string template engine and interpreter. It embeds processing logic, conditionals, and transformation pipelines directly inside plain text strings.
No eval(). No runtime dependencies. Safe for user-provided templates.
๐ก Real-World Use Cases
- ๐ Dynamic Translations: Store translations with built-in pluralization and fallbacks directly in your lang files:
'{count.plural("%s item", "%s items", "No items")}' - ๐ง Notification & Email Templates: Marketers and editors write smart strings without developers touching PHP:
'Hi {name.or("there")}! Order #{id} is {status.upper}. Details: {notes.flatten_lines.if_empty("None")}' - ๐งฉ Safe CMS Sandboxing: Safe execution of user-authored templates with a deterministic lexer (strictly zero
eval()).
โก Syntax at a Glance
- ๐ฏ Direct Execution (
@): Run standalone functions or chain pipelines onto them without a variable:{@date('Y')}or{@rand(1, 100).if_gte('50', 'Pass (%s)', 'Fail (%s)')}or{@line} - ๐ Pipeline Chaining (
.): Pipe data through functions using dot notation:{user.trim.lower.title} - ๐ฏ Argument Routing (
$): Pinpoint where the piped value should land:{slug.str_replace('-', ' ', '$')} - ๐ช Deep Nesting: Recursively resolve placeholders inside arguments from inside out:
{@sprintf("Hello %s", "{user.upper}")} - ๐จ Custom Delimiters & Shared Globals (v2): Configure custom tags (
[: :]) and app-wide shared variables.
๐ Installation & Quick Start
๐ Documentation & Guides
For the complete manual, interactive search, comprehensive API reference, and production recipes:
- ๐ Interactive Documentation Site (GitHub Pages)
- ๐ Full In-Repo Documentation (
docs/index.md)- Core Concepts & Safe Lexer
- Direct Execution (
@) - Built-in Functions Arsenal (30+ Helpers)
- Extending Risma (addFunc, addClass, addObject)
- Engine API Reference
- Production Recipes & Scenarios
๐งช Testing
๐ License
Risma is open-sourced software licensed under the MIT License.