<?php

class Helper
{
    public static function generateSlug($text)
    {
        $text = strtolower($text);
        $text = preg_replace('/[^a-z0-9]+/', '-', $text);
        $text = trim($text, '-');

        return $text;
    }

    public static function generateToken($length = 32)
    {
        return bin2hex(random_bytes($length));
    }

    public static function sanitize($data)
    {
        return htmlspecialchars(strip_tags(trim($data)));
    }
}