If you've ever wanted a lightweight, flexible way to handle dynamic content in PHP, Risma might be exactly what you need. Risma is a high-performance string processing and template engine that supports intuitive function chaining.
Why Risma?
Risma shines when you need to transform raw text into dynamic content. It's perfect for:
- Template engines
- Dynamic notifications
- Content sanitization
Its key features include:
- Variable Injection: Replace placeholders with dynamic data.
- Function Chaining: Pipe data through multiple functions effortlessly.
- Nested Placeholders: Resolve placeholders recursively.
- Global & Custom Functions: Use PHP functions or your own.
- Class Integration: Map class methods directly to your pipeline.
- Clean Syntax: {var.func1.func2} style, intuitive and readable.
Getting Started
Install via Composer:
composer require nabeghe/risma
Basic usage:
use Nabeghe\Risma\Risma;
$risma = new Risma();
echo $risma->render("Hello {name}!", ['name' => 'Hadi']);
// Output: Hello Hadi!
Function Chaining Example
$text = "Welcome, {user.strtoupper}!";
echo $risma->render($text, ['user' => 'alice']);
// Output: Welcome, ALICE!
Direct Function Calls
$text = "Current Year: {@date('Y')}";
echo $risma->render($text, []);
// Output: Current Year: 2026
Risma lets you write PHP-driven templates without the heavy boilerplate, keeping your code clean, dynamic, and readable.
Top comments (0)