happyr/excerpt-bundle

A Symfony2 Bundle to make excerpts

Installs: 426

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 3

Forks: 1

Open Issues: 6

Type:symfony-bundle

0.1.0 2014-06-05 09:22 UTC

This package is auto-updated.

Last update: 2024-03-25 05:26:36 UTC


README

The purpose of this is to try Hack programming language. This is not the fastest or the most elegant way of programming. But it is a good bundle to show in a demo. I wrote a blog post about this bundle on developer.happyr.com.

The Excerpt Bundle takes an excerpt from a HTML string. We make sure to return valid HTML and we do not break words.

Installation

  1. Install with composer:
composer require happyr/excerpt-bundle
  1. Enable the bundle:
// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
        new HappyR\ExcerptBundle\HappyRExcerptBundle(),
    ];
}

Using the Twig filter

{{ '<p>Hello World Foobar!</p>'|excerpt(17) }} 
{# <p>Hello World...</p> #}

Default Configuration

happy_r_excerpt:
    tail: '...'
    length: 300