crecket/custom-twig-extension 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

crecket/custom-twig-extension

最新稳定版本:2.2

Composer 安装命令:

composer require crecket/custom-twig-extension

包简介

My custom twig extension

README 文档

README

GitHub release Packagist

Content

  1. Introduction
  2. Requirements
  3. Installation
  4. Usage
  5. License

Introduction

This repo contains my custom twig extension. In here you'll find a few native php functions added to twig as a twig extension. Things like creating a random number or using json_decode can now be done directly in Twig.

Requirements

  • Twig ^1.25

Installation

Composer

  1. Require the repo with composer composer require crecket/custom-twig-extension
  2. Add the extension to the twig view (custom_twig_extension is the class)
$twig = new Twig_Environment();
$twig->addExtension(new custom_twig_extension());

Manual

  1. Download the source
  2. Require the file
  3. Add the extension to the twig view

Usage

Using these functions and filters is the same as the native functions and filters.

Quick example:

  • print_r()
{{ print_r(array) }}
  • json_decode
{{ some_variable|json_decode }}

List

Functions

  1. dumpPre(var1, var2, var3 ...)
  2. md5(password)
  3. password_hash(password)
  4. phpinfo()
  5. print_r(array)
  6. pseudoBytes(length)
  7. randomHex(length)
  8. randomInt(length)
  9. randomString(length)
  10. unsetSession(key)
  11. wordwrap(string, length, limiter = "\n", cut)

Filters

  1. json_decode
  2. urlDecode

Globals

  1. sessionVars //Returns all php SESSION variables in array form

统计信息

  • 总下载量: 144
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: WTFPL
  • 更新时间: 2015-10-30