Element API - 'String' to 'kebab-case' I want to convert a String into kebab-case.

'Hello there' -&gt; 'hello-there'


I'm working in the Element API, so haven't got the pleasure of using the simple Twig filter. I guess there is a way of doing it in PHP. Any suggestions? Thank you
You can actually use the StringHelper::toKebabCase  function for this:

$string = 'Hello there';
$result = StringHelper::toKebabCase($string);
// =&gt; 'hello-there'