codesaur / template
Энгийн текст-суурьтай темплейтээс эхлээд Twig-ээр бичсэн хүчирхэг темплейт хүртэл дэмждэг минимал, өргөтгөх боломжтой PHP template engine
Installs: 177
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/codesaur/template
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2026-01-08 04:47:09 UTC
README
Агуулга / Table of Contents
- Монгол | 2. English | 3. Getting Started
1. Монгол тайлбар
Энгийн текст-суурьтай темплейтээс эхлээд Twig-ээр бичсэн хүчирхэг темплейт хүртэл дэмждэг минимал, өргөтгөх боломжтой template engine.
codesaur/template нь codesaur ecosystem-ийн нэг хэсэг бөгөөд энгийн
текст-суурьтай темплейтээс эхлээд Twig-ээр бичсэн хүчирхэг темплейт хүртэл
дэмждэг минимал, өргөтгөх боломжтой PHP template engine юм.
Багц нь дараах 3 үндсэн class-аас бүрдэнэ:
- MemoryTemplate - энгийн {{key}} placeholder-той lightweight engine
- FileTemplate - файл суурьтай template loader
- TwigTemplate - Twig engine-тэй бүрэн интеграцлагдсан advanced renderer
Дэлгэрэнгүй мэдээлэл
- 📖 Бүрэн танилцуулга - Суурилуулалт, хэрэглээ, жишээнүүд
- 📚 API тайлбар - Бүх метод, exception-үүдийн тайлбар
- 🔍 Шалгалтын тайлан - Код шалгалтын тайлан
2. English description
A minimal, extensible template engine that supports everything from simple text-based templates to powerful templates written with Twig.
codesaur/template is part of the codesaur ecosystem and is a minimal, extensible PHP template engine that supports everything from simple text-based templates to powerful templates written with Twig.
The package consists of the following 3 core classes:
- MemoryTemplate - lightweight engine with simple {{key}} placeholders
- FileTemplate - file-based template loader
- TwigTemplate - advanced renderer fully integrated with Twig engine
Documentation
- 📖 Full Documentation - Installation, usage, examples
- 📚 API Reference - Complete API documentation
- 🔍 Review - Code review report
3. Getting Started
Requirements
- PHP 8.2.1+ (JSON extension is included by default)
- Composer
- Optional:
twig/twig(^3.22.2) - Required only for TwigTemplate
Installation
Composer ашиглан суулгана / Install via Composer:
composer require codesaur/template
Quick Example
use codesaur\Template\MemoryTemplate; // Энгийн жишээ / Simple example $template = new MemoryTemplate('Hello, {{ name }}!', ['name' => 'World']); echo $template; // Output: "Hello, World!" // Олон түвшний хувьсагч / Nested variables $template = new MemoryTemplate('Email: {{ user.email }}', [ 'user' => ['email' => 'test@example.com'] ]); echo $template; // Output: "Email: test@example.com"
Running Tests
Тест ажиллуулах / Run tests:
# Бүх тестүүдийг ажиллуулах / Run all tests composer test # Coverage-тэй тест ажиллуулах / Run tests with coverage composer test:coverage
Changelog
- 📝 CHANGELOG.md - Full version history
Contributing & Security
License
This project is licensed under the MIT License.
Author
Narankhuu
📧 codesaur@gmail.com
🌐 https://github.com/codesaur
🦖 codesaur Ecosystem: https://codesaur.net