承接 byjg/jinja-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

byjg/jinja-php

最新稳定版本:6.0.0

Composer 安装命令:

composer require byjg/jinja-php

包简介

Lightweight PHP implementation of the Jinja2 template engine originally developed for Python

README 文档

README

Sponsor Build Status Opensource ByJG GitHub source GitHub license GitHub release

Lightweight PHP implementation of the Jinja2 template engine originally developed for Python.

Overview

This library allows you to seamlessly process Jinja templates in PHP applications. It provides a familiar syntax for those coming from Python while offering a native PHP implementation.

Key Features

  • Python Compatibility: Process the same Jinja templates in both Python and PHP
  • Variable Support: Full support for variables, properties, and nested structures
  • Conditional Logic: if/else statements for conditional rendering
  • Loops: Iterate over arrays and objects with for loops
  • Filters: Transform output with built-in filters like upper, lower, default, etc.
  • Flexible Loaders: Load templates from strings or the filesystem
  • Undefined Variable Handling: Different strategies for handling undefined variables
  • Expressions: Support for mathematical operations, comparisons, and concatenation

Usage

use ByJG\JinjaPhp\Template;
use ByJG\JinjaPhp\Undefined\DebugUndefined;

$templateString = <<<EOT
Hello {{ name }}
EOT;

$template = new Template($templateString);
$template->withUndefined(new DebugUndefined());  // Default is StrictUndefined

$variables = [
    'name' => 'World'
];
echo $template->render($variables);

Documentation

The detailed documentation is organized as follows:

  1. Basic Usage
  2. Template Syntax
  3. Loaders
  4. Undefined Variables
  5. Filters
  6. Control Structures
  7. Advanced Topics
  8. API Reference
  9. PHP Jinja vs Python Jinja2 Comparison

Installation

composer require byjg/jinja-php

Dependencies

flowchart TD  
    byjg/jinja-php   
Loading

Open source ByJG

统计信息

  • 总下载量: 35.19k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 1
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 1
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固