定制 liip/hyphenator-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

liip/hyphenator-bundle

最新稳定版本:2.0.0

Composer 安装命令:

composer require liip/hyphenator-bundle

包简介

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

关键字:

README 文档

README

Adds support for hyphenating long words using the Org_Heigl_Hyphenator library.

This bundle will add a Twig Extension for templates and a Hyphenator service.

Build Status

Installation

  1. Download the Bundle

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

    $ composer require liip/hyphenator-bundle

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

  2. Enable the Bundle

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

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

    The supported options for the Hyphenator with the defaults are:

    # 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.

    For details about their meaning consult the Hyphenator library documentation.

Usage

This library adds a filter for twig templates that can be used like:

{{ "Somelongwordtohyphenate"|hyphenate }}

Alternatively the filter can be applied to an entire block:

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

Furthermore its possible to pass in a locale as a parameter if the default locale should not be used:

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

统计信息

  • 总下载量: 2.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 20
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 20
  • Watchers: 40
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固