2017 © Pedro Peláez
 

library custom-twig-extension

My custom twig extension

image

crecket/custom-twig-extension

My custom twig extension

  • Thursday, April 28, 2016
  • by Crecket
  • Repository
  • 1 Watchers
  • 0 Stars
  • 134 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

custom-twig-extension

GitHub release Packagist, (*1)

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., (*2)

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., (*3)

Quick example: - print_r(), (*4)

{{ 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

The Versions

28/04 2016

dev-develop

dev-develop https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

17/04 2016

dev-master

9999999-dev https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

17/04 2016

2.2

2.2.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

12/04 2016

2.1

2.1.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

12/01 2016

2.0

2.0.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

12/01 2016

1.8.1

1.8.1.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

12/01 2016

1.8

1.8.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

08/01 2016

1.7.1

1.7.1.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

08/01 2016

1.7

1.7.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

31/12 2015

1.6

1.6.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

06/12 2015

1.5

1.5.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

06/11 2015

1.4

1.4.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

05/11 2015

1.3.2

1.3.2.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

30/10 2015

1.3

1.3.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

30/10 2015

1.2.0

1.2.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

30/10 2015

1.1.0

1.1.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts

30/10 2015

1.0.0

1.0.0.0 https://github.com/Crecket/custom-twig-extension

My custom twig extension

  Sources   Download

WTFPL

The Requires

 

by Gregory Goijaerts