diff --git a/src/Twig/Extension/PhpFunctions.php b/src/Twig/Extension/PhpFunctions.php
index <HASH>..<HASH> 100644
--- a/src/Twig/Extension/PhpFunctions.php
+++ b/src/Twig/Extension/PhpFunctions.php
@@ -35,6 +35,7 @@ class PhpFunctions extends Twig_Extension
             new Twig_SimpleFilter('getclass', 'get_class'),
             new Twig_SimpleFilter('strlen', 'strlen'),
             new Twig_SimpleFilter('count', 'count'),
+            new Twig_SimpleFilter('ksort', [$this, '_ksort']),
             new Twig_SimpleFilter('php_*', [$this, '_callPhpFunction']),
         ];
     }
@@ -58,4 +59,11 @@ class PhpFunctions extends Twig_Extension
 
         return @call_user_func_array($func, $args);
     }
+
+    function _ksort($array)
+    {
+        ksort($array);
+
+        return $array;
+    }
 }
Alled filter ksort to Twig extension PhpFunctions