Download the PHP package codewithkyrian/jinja-php without Composer
On this page you can find all versions of the php package codewithkyrian/jinja-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codewithkyrian/jinja-php
More information about codewithkyrian/jinja-php
Files in codewithkyrian/jinja-php
Package jinja-php
Short Description A minimalistic PHP implementation of the Jinja templating engine, specifically designed for parsing and rendering ML chat templates.
License MIT
Informations about the package jinja-php
Jinja PHP
A minimalistic zero-dependency PHP implementation of the Jinja templating engine, specifically designed for parsing and rendering machine learning (ML) chat templates. This project is heavily inspired by HuggingFace's Jinja template engine in JavaScript, intended primarily for ML chat templates, but is versatile enough to be used for general purposes of parsing most Jinja templates.
Installation
Install Jinja PHP through Composer:
Usage
Here’s how you can use Jinja PHP to render a template:
Advanced Usage
Jinja PHP supports various control structures from Jinja templates. Here are some examples:
Conditional Statements:
For Loops
Variable Filters
Comprehensive Feature Support
Jinja PHP is designed to be robust and feature-rich, offering support for a wide range of functionalities beyond the
basics of templating. This includes handling exceptions, using default string methods like strip()
or upper()
,
working with dictionaries, and much more. If there's a feature you need that isn't currently implemented in Jinja PHP,
we encourage you to request it. Additionally, if you're
proficient with PHP and understand the internals of templating engines, consider contributing to the project by
submitting a pull request with your proposed feature.
Testing
Jinja PHP comes with a suite of tests to ensure functionality remains consistent and reliable. To run the tests:
Contributors
- Kyrian Obikwelu
- Other contributors are welcome.
Acknowledgements
- Hugging Face for their work on ML chat templates.
- The Jinja template engine for Python, which served as the primary inspiration for this project.
Support
If you find any issues or have a question, feel free to open an issue in the repo.
License
This project is licensed under the MIT License. See the LICENSE file for more information.