PHPackages                             ornj/twig-extensions-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. ornj/twig-extensions-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

ornj/twig-extensions-bundle
===========================

Provides helpful Twig extensions for Symfony2

0363PHP

Since Aug 6Pushed 12y ago1 watchersCompare

[ Source](https://github.com/ornj/twig-extensions-bundle)[ Packagist](https://packagist.org/packages/ornj/twig-extensions-bundle)[ RSS](/packages/ornj-twig-extensions-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

twig-extensions-bundle
======================

[](#twig-extensions-bundle)

This bundle contains helpful Twig extensions for the Symfony2 framework. These extensions provide simple, front end functionality that is often times present on web pages.

Installation
------------

[](#installation)

Install this bundle in your Symfony2 project by adding it to your `composer.json`.

```
{
    "require": {
        "ornj/twig-extensions-bundle": "dev-master"
    }
}
```

After running updating composer, register the bundle in `app/AppKernel.php`.

```
 $bundles = array(
    // ...
    new Ornj\Bundle\TwigExtensionsBundle\OrnjTwigExtensionsBundle(),
 );
```

Included Extensions
-------------------

[](#included-extensions)

#### is\_external

[](#is_external)

Determines if the url points to a host external to the current site.

#### Arguments

[](#arguments)

1. `host`: Provide the host you want to check against. You can get the current host by passing `app.request.httpHost`.

```
{{ 'http://www.example.com' | is_external(app.request.httpHost) }}
```

#### facebook\_share

[](#facebook_share)

Generates a url for sharing the current page on Facebook. Accepts the following parameters:

##### Arguments

[](#arguments-1)

1. `picture`: path to an image
2. `name`: the post title
3. `caption`: caption to show next to the image
4. `description`: content of the post
5. `redirect`: where to send the user after they share the post

```
{{ url('route', { id: entity.id }) | facebook_share('http://example.com/images/img.jpg', 'name', 'caption', 'description', 'example.com/redirect) }}
```

In addition to the above parameters you must also provide a Facebook application id. Currently the parameter `facebook_app_id`is being used. You can set the parameter however you'd like. One location this could be defined is in `app/config/parameters.yml`.

#### pinterest\_share

[](#pinterest_share)

Generates a url for sharing the current page on Pinterest. Accepts the following parameters:

##### Arguments

[](#arguments-2)

1. `media`: path to the media being pinned
2. `description`: content of the post

```
{{ url('route', { id: entity.id }) | pinterest_share('http://example.com/images/img.jpg', 'description') }}
```

#### twitter\_share

[](#twitter_share)

Generates a url for sharing the current page on Twitter. Accepts a message to input into the tweet.

##### Arguments

[](#arguments-3)

1. `message`: Body of the tweet

```
{{ url('route', { id: entity.id }) | twitter_share('Check out this page!') }}
```

To Do
-----

[](#to-do)

1. Make Facebook app id paramater a config setting instead of a parameter in parameters.yml

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/199645?v=4)[Stephen Hurwitz](/maintainers/ornj)[@ornj](https://github.com/ornj)

---

Top Contributors

[![ornj](https://avatars.githubusercontent.com/u/199645?v=4)](https://github.com/ornj "ornj (13 commits)")

### Embed Badge

![Health badge](/badges/ornj-twig-extensions-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/ornj-twig-extensions-bundle/health.svg)](https://phpackages.com/packages/ornj-twig-extensions-bundle)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3861.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.0k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.2k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

281.8k](/packages/webkinder-sproutset)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
