<?php
function slugger(string $input)
{
    return 
$input
        
|> \strtolower(...)
        |> fn(
$x) => \preg_replace('/[^a-z]/''-'$x)
        |> fn(
$x) => \trim($x'-')
        |> fn(
$x) => \preg_replace('/-+/''-'$x); 
}







var_dump(slugger('Hello, World!')); // string(11) "hello-world"
?>