Skip to content
Twig extension that implements sorting functions in Twig template
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
composer.json
ravenflux.jpg

README.md

Twig Sort Functions

Latest Stable Version Latest Unstable Version License Total Downloads

Twig extension that implements sorting functions in Twig template.

Installation

The recommended way to install is via Composer:

composer require ravenflux/sort-functions

For Symfony usage, import ravenflux/sort-function services.yaml file:

# config/services.yaml
imports:
    - { resource: '../vendor/ravenflux/sort-functions/src/Resources/config/services.yaml' }

Usage

{% for user in users|usort('name') %}
    {{ user.name }}
{% endfor %}
{% for user in users|usort('name', 'DESC') %}
    {{ user.name }}
{% endfor %}
You can’t perform that action at this time.