Util.php 326 B

12345678910111213141516
  1. <?php
  2. namespace App;
  3. class Util {
  4. public static function slug(string $string, string $glue = "-"): string {
  5. $string = strtolower($string);
  6. return preg_replace("/[^a-z\d]+/i", $glue, $string);
  7. }
  8. public static function createDirectory(string $path): bool {
  9. return !mkdir($path, 0777, true) && !is_dir($path);
  10. }
  11. }