PHPackages                             cviebrock/twig-natural-join - 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. cviebrock/twig-natural-join

ActiveLibrary[Templating &amp; Views](/categories/templating)

cviebrock/twig-natural-join
===========================

Twig filter that joins an array using a different separator for the last element

0.9.1(11y ago)15.0k2MITPHPPHP &gt;=5.3.0

Since Oct 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/cviebrock/twig-natural-join)[ Packagist](https://packagist.org/packages/cviebrock/twig-natural-join)[ Docs](http://github.com/cviebrock/twig-natural-join)[ RSS](/packages/cviebrock-twig-natural-join/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

twig-natural-join
=================

[](#twig-natural-join)

Twig filter that joins an array using a different separator for the last element (e.g. "John, Mary, Bob and Jim").

[![Total Downloads](https://camo.githubusercontent.com/b5e29aa44c41bcb33936878227dfd9e35c2331ee4871aaa8b71c5c580d65c76b/68747470733a2f2f706f7365722e707567782e6f72672f6376696562726f636b2f747769672d6e61747572616c2d6a6f696e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/cviebrock/twig-natural-join)[![Latest Stable Version](https://camo.githubusercontent.com/30b1006d05aa7ce4e90d74173167e3bf2c26c63146c8df13904b0d099b1eaaf6/68747470733a2f2f706f7365722e707567782e6f72672f6376696562726f636b2f747769672d6e61747572616c2d6a6f696e2f762f737461626c652e706e67)](https://packagist.org/packages/cviebrock/twig-natural-join)

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

[](#installation)

The filter is registered at Packagist as [cviebrock/twig-natural-join](https://packagist.org/packages/cviebrock/twig-natural-join) and can be installed using [composer](http://getcomposer.org/):

```
"require": {
	...
	"cviebrock/twig-natural-join": "0.9.*",
}

```

Or just download the zip file and copy the file into your *src* folder.

Enable the extension:

```
$twig = new Twig_Environment($loader, $options);
$twig->addExtension(new Cviebrock\Twig\NaturalJoinExtension());
```

If you are using Laravel and [rcrowe/twigbridge](https://github.com/rcrowe/TwigBridge), then enable the extension by adding an entry to the `enabled` array in `app/config/packages/rcrowe/twigbridge/extensions.php`:

```
'enabled' => [
	...
	'Cviebrock\Twig\NaturalJoinExtension',
],
```

Usage
-----

[](#usage)

Pass the normal seperator and final seperator to the filter:

```
{{ names|naturaljoin(", ", " and ") }}          // John, Bill, Bob and Mary
```

Optionally pass `true` as a third argument to turn on "Oxford" mode, which will add a normal seperator before the final seperator:

```
{{ names|naturaljoin(", ", " and ", true) }}    // John, Bill, Bob, and Mary
```

Bugs, Suggestions and Contributions
-----------------------------------

[](#bugs-suggestions-and-contributions)

Please use Github for bugs, comments, suggestions.

1. Fork the project.
2. Create your bugfix/feature branch and write your (well-commented) code.
3. Commit your changes and push to your repository.
4. Create a new pull request against this project's `master` branch.

Copyright and License
---------------------

[](#copyright-and-license)

**twig-natural-join** was written by Colin Viebrock and released under the MIT License. See the LICENSE file for details.

Copyright 2014 Colin Viebrock

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

4241d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3b6c8249f9ade65deeb3667fdf717ca934828c0c5fd2341dfdb62ab01414791?d=identicon)[cviebrock](/maintainers/cviebrock)

---

Top Contributors

[![cviebrock](https://avatars.githubusercontent.com/u/166810?v=4)](https://github.com/cviebrock "cviebrock (1 commits)")

---

Tags

twigtemplatingfilterjoin

### Embed Badge

![Health badge](/badges/cviebrock-twig-natural-join/health.svg)

```
[![Health](https://phpackages.com/badges/cviebrock-twig-natural-join/health.svg)](https://phpackages.com/packages/cviebrock-twig-natural-join)
```

###  Alternatives

[timber/timber

Create WordPress themes with beautiful OOP code and the Twig Template Engine

5.7k3.4M111](/packages/timber-timber)[shoot/shoot

Shoot aims to make providing data to your templates more manageable

40229.9k2](/packages/shoot-shoot)[goetas/twital

PHP templating engine that combines Twig and PHPTal power points

12813.1k1](/packages/goetas-twital)[goetas/twital-bundle

Twital templating engine Symfony Bundle

206.8k](/packages/goetas-twital-bundle)[tommcdo/kohana-twig

Kohana 3.3 module for the popular Twig template engine

241.9k](/packages/tommcdo-kohana-twig)

PHPackages © 2026

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