2017 © Pedro Peláez
 

library linkify-twig-extension

Twig extension for Linkify - converts URLs and email addresses into HTML links

image

manuelodelain/linkify-twig-extension

Twig extension for Linkify - converts URLs and email addresses into HTML links

  • Thursday, February 4, 2016
  • by manuelodelain
  • Repository
  • 1 Watchers
  • 3 Stars
  • 93 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 19 % Grown

The README.md

Linkify Twig extension

Use Linkify in your twig template., (*1)

Installation

Using Composer: composer require manuelodelain/linkify-twig-extension, (*2)

Usage

use manuelodelain\Twig\Extension\LinkifyExtension;
use Twig\Environment;

$twig = new Environment(...);

$twig->addExtension(new LinkifyExtension());
{{ 'Lorem ipsum ... www.website.com ...'|linkify }}

Will output:, (*3)

Lorem ipsum ... <a href="www.website.com">www.website.com</a> ...

Don't forget to apply the raw filter for an HTML output:, (*4)

{{ 'Lorem ipsum ... www.website.com ...'|linkify|raw }}

Options

As Linkify, set default options at the instanciation or at the method call., (*5)

At the instanciation (applied to all links):, (*6)

use manuelodelain\Twig\Extension\LinkifyExtension;

$twig = new Environment(...);

$twig->addExtension(new LinkifyExtension(array('attr' => array('target' => '_blank'))));

At the method call:, (*7)

{{ 'Lorem ipsum ... www.website.com ...'|linkify({"attr": {"target": "_blank"}}) }}

Will output:, (*8)

Lorem ipsum ... <a href="www.website.com" target="_blank">www.website.com</a> ...

See the Linkify options, (*9)

The Versions

04/02 2016

dev-master

9999999-dev

Twig extension for Linkify - converts URLs and email addresses into HTML links

  Sources   Download

MIT

The Requires

 

The Development Requires

04/02 2016

v1.0

1.0.0.0

Twig extension for Linkify - converts URLs and email addresses into HTML links

  Sources   Download

MIT

The Requires

 

The Development Requires