22 lines
380 B
PHP
22 lines
380 B
PHP
<?php
|
|
/**
|
|
* Simple Security Helpers
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Core;
|
|
|
|
final class Security
|
|
{
|
|
public static function sanitize(string $data): string
|
|
{
|
|
return htmlspecialchars(strip_tags(trim($data)));
|
|
}
|
|
|
|
public static function generateRandomString(int $length = 32): string
|
|
{
|
|
return bin2hex(random_bytes($length / 2));
|
|
}
|
|
}
|