# Scape Templates A lightweight, standalone PHP template engine designed for simplicity, security, and performance. Scape focuses on being an **Output Engine first**, marrying pre-processed data with design while enforcing a "logic-light" philosophy. ## Features - **Dot Notation & Bracket Access**: Effortlessly access nested objects and arrays. - **Inheritance & Blocks**: Define base layouts and override sections in child templates. - **Partials & Includes**: Reuse template snippets with controlled data scoping. - **Filter Pipeline**: Transform data using built-in or custom filters (e.g., `{{ var | lower | ucfirst }}`). - Built-in filters: `lower`, `upper`, `ucfirst`, `currency`, `float`, `date`, `truncate`, `default`, `json`, `url_encode`, `join`, `first`, `last`, `word_count`, `keys`. - Filters can be used in variable interpolations, `foreach` loops, and `include` tags. - **Secure by Default**: Automatic contextual HTML escaping for all variables. - **AST Caching**: High performance via Abstract Syntax Tree caching with automatic dev-mode invalidation. - **Host Integration (IoC)**: Easy integration with frameworks through the reserved `host` namespace. - **Logic-Light**: Encourages separation of concerns by supporting only necessary logic like `foreach`. ## Installation ```bash composer require getphred/scape ``` ## Quick Start ```php use Scape\Engine; $engine = new Engine([ 'templates_dir' => __DIR__ . '/templates', 'mode' => 'debug' // or 'production' ]); echo $engine->render('index', [ 'title' => 'Welcome to Scape', 'user' => ['name' => 'Funky'] ]); ``` ### Basic Syntax #### Interpolation (Escaped) `{{ user.name }}` #### Raw Interpolation `{{{ raw_html }}}` #### Loops ```html {( foreach item in items )}