2017 © Pedro Peláez
 

symfony-bundle hyphenator-bundle

This Bundle provides support for hyphenating long words using the Org_Heigl_Hyphenator library

image

liip/hyphenator-bundle

This Bundle provides support for hyphenating long words using the Org_Heigl_Hyphenator library

  • Tuesday, December 5, 2017
  • by lsmith
  • Repository
  • 39 Watchers
  • 19 Stars
  • 1,793 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

Introduction

Adds support for hyphenating long words using the Org_Heigl_Hyphenator library., (*1)

This bundle will add a Twig Extension for templates and a Hyphenator service., (*2)

Build Status, (*3)

Installation

  1. Download the Bundle, (*4)

    Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:, (*5)

    $ composer require liip/hyphenator-bundle
    

    This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*6)

  2. Enable the Bundle, (*7)

    Add the following line in the app/AppKernel.php file to enable this bundle only for the test environment:, (*8)

    <?php
    // app/AppKernel.php
    
    // ...
    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            ..
    
            new Liip\HyphenatorBundle\LiipHyphenatorBundle(),
    
            return $bundles
        }
    
        // ...
    }
    
  3. Configure the bundle:, (*9)

    The supported options for the Hyphenator with the defaults are:, (*10)

    # app/config/config.yml
    liip_hyphenator:
        default_locale: 'en_GB'
        hyphen: &shy;
        left_min: 2
        right_min: 2
        word_min: 6
        quality: highest # either the quality name, either the value of the constant
        no_hyphenate_string: ''
        custom_hyphen: --
        tokenizers: ['liip_hyphenator.tokenizer.whitespace', 'liip_hyphenator.tokenizer.punctuation']
        filters: ['liip_hyphenator.filter.simple']
    

    All settings are optional. Caution: default_localeneeds to be a fully qualified locale like en_EN, en will not work., (*11)

    For details about their meaning consult the Hyphenator library documentation., (*12)

Usage

This library adds a filter for twig templates that can be used like:, (*13)

{{ "Somelongwordtohyphenate"|hyphenate }}

Alternatively the filter can be applied to an entire block:, (*14)

{% filter hyphenate %}
...
Somelongwordtohyphenate
....
{% endfilter %}

Furthermore its possible to pass in a locale as a parameter if the default locale should not be used:, (*15)

{{ "Somelongwordtohyphenate"|hyphenate("de") }}

The Versions

24/10 2015

2.0.0

2.0.0.0 http://liip.ch

This Bundle provides support for hyphenating long words using the Org_Heigl_Hyphenator library

  Sources   Download

MIT

The Requires

 

The Development Requires

hyphenation

26/12 2014

1.0.0

1.0.0.0 http://liip.ch

This Bundle provides support for hyphenating long words using the Org_Heigl_Hyphenator library

  Sources   Download

MIT

The Requires

 

hyphenation