aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Häggqvist <[email protected]>2016-01-27 01:27:35 +0100
committerVictor Häggqvist <[email protected]>2016-01-27 01:27:35 +0100
commit36ed485f1a82c9a382b5ca63da60a73429f85921 (patch)
treefb702d895ddae6f1793cec673b93836b5b73879d
parent5d147de5db3679fefd6afa70149a5a454a52b015 (diff)
update readmecollections
-rw-r--r--README.md15
1 files changed, 14 insertions, 1 deletions
diff --git a/README.md b/README.md
index 15ac225..81ecd19 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,14 @@
# Twig SortByField Extension [![](https://img.shields.io/travis/victorhaggqvist/Twig-sort-by-field.svg?style=flat)](https://travis-ci.org/victorhaggqvist/Twig-sort-by-field)
A Twig Extension filter to sort an array of entries (objects or arrays) by an entry field.
+Since version 0.1.5 Doctrine collections can be sorted as is with no need to manually extract the array first.
+
## Install
With composer
composer require snilius/twig-sort-by-field
-## Sample
+## Usage
The list could look like this, but obviously with more than one key per array.
```php
@@ -34,6 +36,17 @@ $base = array(
{% endfor %}
```
+For Symfony usage you'll want to add it as a service and tag it for Twig.
+
+```yml
+# app/config/services.yml
+services:
+ twig.extension.sortbyfield:
+ class: Snilius\Twig\SortByFieldExtension
+ tags:
+ - { name: twig.extension }
+```
+
## License
Copyright 2015 Victor Häggqvist