PHPackages                             nativephp/mobile-device - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nativephp/mobile-device

ActiveNativephp-plugin[Utility &amp; Helpers](/categories/utility)

nativephp/mobile-device
=======================

Device hardware operations for NativePHP Mobile

1.0.2(1mo ago)12.9k↑127.8%2[1 PRs](https://github.com/NativePHP/mobile-device/pulls)1MITKotlinPHP ^8.2

Since Jan 19Pushed 3mo agoCompare

[ Source](https://github.com/NativePHP/mobile-device)[ Packagist](https://packagist.org/packages/nativephp/mobile-device)[ RSS](/packages/nativephp-mobile-device/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (1)

Device Plugin for NativePHP Mobile
==================================

[](#device-plugin-for-nativephp-mobile)

Device hardware operations including vibration, flashlight, device info, and battery status.

Overview
--------

[](#overview)

The Device API provides access to device hardware features and information.

Installation
------------

[](#installation)

```
composer require nativephp/mobile-device
```

Usage
-----

[](#usage)

### PHP (Livewire/Blade)

[](#php-livewireblade)

```
use Native\Mobile\Facades\Device;

// Vibrate the device
Device::vibrate();

// Toggle flashlight
$result = Device::toggleFlashlight();
// Returns: ['success' => true, 'state' => true|false]

// Get device ID
$result = Device::getId();
// Returns: ['id' => 'unique-device-id']

// Get device info
$result = Device::getInfo();
// Returns: ['info' => '{"name":"iPhone","model":"iPhone","platform":"ios",...}']

// Get battery info
$result = Device::getBatteryInfo();
// Returns: ['info' => '{"batteryLevel":0.85,"isCharging":false}']
```

### JavaScript (Vue/React/Inertia)

[](#javascript-vuereactinertia)

```
import { Device } from '#nativephp';

// Vibrate the device
await Device.vibrate();

// Toggle flashlight
const flashResult = await Device.toggleFlashlight();
console.log('Flashlight state:', flashResult.state);

// Get device ID
const idResult = await Device.getId();
console.log('Device ID:', idResult.id);

// Get device info
const infoResult = await Device.getInfo();
const info = JSON.parse(infoResult.info);
console.log('Platform:', info.platform);

// Get battery info
const batteryResult = await Device.getBatteryInfo();
const battery = JSON.parse(batteryResult.info);
console.log('Battery level:', battery.batteryLevel * 100 + '%');
```

Methods
-------

[](#methods)

### `vibrate(): array`

[](#vibrate-array)

Vibrate the device.

**Returns:** `{ success: true }`

### `toggleFlashlight(): array`

[](#toggleflashlight-array)

Toggle the device flashlight on/off.

**Returns:** `{ success: boolean, state: boolean }`

### `getId(): array`

[](#getid-array)

Get the unique device identifier.

**Returns:** `{ id: string }`

- iOS: Uses `identifierForVendor` UUID
- Android: Uses `ANDROID_ID`

### `getInfo(): array`

[](#getinfo-array)

Get detailed device information.

**Returns:** `{ info: string }` (JSON string)

Device info includes:

- `name` - Device name
- `model` - Device model
- `platform` - "ios" or "android"
- `operatingSystem` - OS name
- `osVersion` - OS version string
- `manufacturer` - Device manufacturer
- `isVirtual` - Whether running in simulator/emulator
- `memUsed` - Memory usage in bytes
- `webViewVersion` - WebView version

### `getBatteryInfo(): array`

[](#getbatteryinfo-array)

Get battery level and charging status.

**Returns:** `{ info: string }` (JSON string)

Battery info includes:

- `batteryLevel` - Battery level from 0.0 to 1.0
- `isCharging` - Whether device is charging

Permissions
-----------

[](#permissions)

### Android

[](#android)

- `android.permission.VIBRATE` - For vibration
- `android.permission.FLASHLIGHT` - For flashlight control

### iOS

[](#ios)

No special permissions required.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance84

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Total

3

Last Release

59d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ab43d3432a80f0f41fe7015280f6024ff13fe8c2306cf114a1fbc91a4cd6f35?d=identicon)[simonhamp](/maintainers/simonhamp)

![](https://www.gravatar.com/avatar/16cc4d562d3f6f302901f1c65eb3ce819c0fb24ab2616241c605126102812ca4?d=identicon)[shanerbaner82](/maintainers/shanerbaner82)

---

Top Contributors

[![shanerbaner82](https://avatars.githubusercontent.com/u/5580860?v=4)](https://github.com/shanerbaner82 "shanerbaner82 (6 commits)")[![simonhamp](https://avatars.githubusercontent.com/u/31628?v=4)](https://github.com/simonhamp "simonhamp (3 commits)")

---

Tags

nativephpnativephp-mobilenativephp-plugin

### Embed Badge

![Health badge](/badges/nativephp-mobile-device/health.svg)

```
[![Health](https://phpackages.com/badges/nativephp-mobile-device/health.svg)](https://phpackages.com/packages/nativephp-mobile-device)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
