str::slug($string, $separator = '-')

Convert a string to a safe version to be used in a URL

  • $text (string)
    The unsafe string
  • $separator (string)
    To be used instead of space and other non-word characters.
  • return (string)
    The safe string

Example

<?php
$string = 'Kirby is a file-based CMS';
echo str::slug($string);

Result:

kirby-is-a-file-based-cms