Initial commit: Cloud Control Panel

This commit is contained in:
2026-01-10 01:24:08 +07:00
commit 01d99c5054
69 changed files with 12697 additions and 0 deletions

23
src/Helpers/helpers.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
if (!function_exists('formatBytes')) {
function formatBytes(int $bytes): string
{
$units = ['B', 'KB', 'MB', 'GB', 'TB'];
$i = 0;
while ($bytes >= 1024 && $i < count($units) - 1) {
$bytes /= 1024;
$i++;
}
return round($bytes, 1) . ' ' . $units[$i];
}
}
if (!function_exists('getStoragePercent')) {
function getStoragePercent(int $categoryBytes, int $totalBytes): float
{
return $totalBytes > 0 ? ($categoryBytes / $totalBytes * 100) : 0;
}
}