Element API - 'String' to 'kebab-case'
You can actually use the StringHelper::toKebabCase  function for this:

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