weizhang / utilities
Package that contains helper classes to perform simple tasks
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/weizhang/utilities
Requires
- php: ^7.2
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2025-12-27 21:54:53 UTC
README
Utilities
- isMobile
check request is from mobile device
deviceCheck = new DeviceCheck();
$deviceCheck->setServerVar($_SERVER);
$isMobile = $deviceCheck->isMobile();
- deviceType
get device type of request
$deviceCheck = new DeviceCheck();
$deviceCheck->setServerVar([
'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0',
'HTTP_ACCEPT' => 'text/plain; q=0.5, text/html,text/x-dvi; q=0.8, text/x-c'
]);
$deviceType = $deviceCheck->deviceType();
- getDownloadSize
get request download size
$file = new Requests();
$size = $file->getDownloadSize(['https://filepath.com']); // size returns is in bytes