srwiez/nativephp-mobile-screen
Composer 安装命令:
composer require srwiez/nativephp-mobile-screen
包简介
Screen wake lock and brightness control for NativePHP Mobile apps
README 文档
README
Keep screens awake. Control brightness. Built for apps users stare at.
A tiny, focused NativePHP plugin for two things mobile devs constantly need: keeping the screen on and controlling brightness. One facade, six methods, zero setup.
Why this plugin?
- ☀️ Keep the screen awake — perfect for barcode tickets, live dashboards, kiosks and scoring apps.
- 🔆 Control brightness — crank to 100% to scan barcodes in sunlight, dim down for dark reading rooms.
- 🪶 Dependency-free — a single wake-lock + brightness wrapper. No bloat, no configuration.
- 📱 Works everywhere — iOS 13+ and Android 5+ (API 21).
Features at a glance
| Feature | Android | iOS |
|---|---|---|
| Keep screen awake | ✅ | ✅ |
| Set brightness (0.0–1.0) | ✅ | ✅ |
| Reset to system default | ✅ | ✅ |
Perfect for
Ticket & boarding-pass apps · Barcode / QR scanners · Kiosk & POS apps · Sports scoreboards · Live dashboards & monitoring · E-readers
Installation
# Install the package composer require srwiez/nativephp-mobile-screen # Publish the plugins provider (first time only) php artisan vendor:publish --tag=nativephp-plugins-provider # Register the plugin php artisan native:plugin:register srwiez/nativephp-mobile-screen # Verify registration php artisan native:plugin:list
This adds \SRWieZ\NativePHP\Mobile\Screen\MobileScreenServiceProvider::class to your plugins() array.
Usage
PHP (Livewire/Blade)
use SRWieZ\NativePHP\Mobile\Screen\Facades\Screen; // Keep screen awake Screen::keepAwake(); // true if wake lock enabled // Allow screen to sleep Screen::allowSleep(); // true if wake lock disabled // Check wake lock status $isAwake = Screen::isAwake(); // bool // Set brightness (0.0 to 1.0) $level = Screen::setBrightness(1.0); // returns actual level, or false on failure // Get current brightness $level = Screen::getBrightness(); // float or null // Reset to system default Screen::resetBrightness(); // returns level or false on failure
JavaScript (Vue/React/Inertia)
import { mobileScreen } from '@srwiez/nativephp-mobile-screen'; // Keep screen awake await mobileScreen.keepAwake(); // Set maximum brightness await mobileScreen.setBrightness(1.0); // Reset when done await mobileScreen.resetBrightness(); await mobileScreen.allowSleep();
API Reference
| Method | Returns | Description |
|---|---|---|
keepAwake(bool $enabled = true) |
bool |
Enable/disable screen wake lock |
allowSleep() |
bool |
Alias for keepAwake(false) |
isAwake() |
bool |
Check if wake lock is active |
setBrightness(float $level) |
bool|float |
Set brightness (0.0-1.0). Returns actual level or false on failure |
getBrightness() |
?float |
Get current brightness level |
resetBrightness() |
bool|float |
Reset to system default. Returns level or false on failure |
Version Support
| Platform | Minimum Version |
|---|---|
| Android | 5.0 (API 21) |
| iOS | 13.0 |
More NativePHP Mobile plugins
Building a mobile app with NativePHP? Check out the rest of the suite:
- Calendar — Native calendars & events from PHP, on both platforms.
- Contacts — Read, create & sync the device address book straight from Laravel.
- Screenshots — Lock down sensitive screens, catch capture attempts, respond instantly.
Support
Bugs, questions, and feature requests should be reported at github.com/SRWieZ/nativephp-mobile-screen/issues.
srwiez/nativephp-mobile-screen 适用场景与选型建议
srwiez/nativephp-mobile-screen 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 402 次下载、GitHub Stars 达 8, 最近一次更新时间为 2026 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 srwiez/nativephp-mobile-screen 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 srwiez/nativephp-mobile-screen 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 402
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-18

