2017 © Pedro Peláez
 

library twig-html-helpers

Rails style view helpers for HTML tags in PHP Twig

image

tourze/twig-html-helpers

Rails style view helpers for HTML tags in PHP Twig

  • Sunday, September 13, 2015
  • by tourze
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 0 Open issues
  • 2 Versions
  • 11 % Grown

The README.md

Twig HTML Helpers Extension

This PHP Twig extension adds the following Rails style HTML helpers:, (*1)

  • check_box_tag($name, $value = '1', $default = false, $options = array())
  • content_tag($name, $content='', $options=array())
  • hidden_field_tag($name, $default = null, $options = array())
  • html_tag($name, $options=array())
  • image_tag($src, $options=array())
  • input_tag($type, $name, $value=null, $options=array())
  • label_tag($name, $text = null, $options = array())
  • labelled_text_field_tag($name, $default = null, $options = array())
  • link_tag($title, $url=null, $options=array())
  • password_field_tag($name = 'password', $default = null, $options = array())
  • radio_button_tag($name, $value, $default = false, $options = array())
  • reset_tag($value = 'Reset', $options = array())
  • select_tag($name, $options, $default = null, $html_options = array())
  • submit_tag($value = 'Submit', $options = array())
  • text_area_tag($name, $default = null, $options = array())
  • text_field_tag($name, $default = null, $options = array())

To use them, first add the extension to your composer.json:, (*2)

"require": {
    "njh/twig-html-helpers": "dev-master"
},

Then load it into your environment:, (*3)

$twig = new Twig_Environment();
$twig->addExtension(new Twig_Extension_HTMLHelpers());

You can then use them in your Twig templates:, (*4)

{{ link_tag('http://www.example.com/') }}

The Versions

13/09 2015

dev-master

9999999-dev https://github.com/tourze/twig-html-helpers

Rails style view helpers for HTML tags in PHP Twig

  Sources   Download

MIT

The Requires

 

The Development Requires

twig html tag

04/09 2015

1.0.0

1.0.0.0 https://github.com/tourze/twig-html-helpers

Rails style view helpers for HTML tags in PHP Twig

  Sources   Download

MIT

The Requires

 

The Development Requires

twig html tag