PHPackages                             nativephp/mobile-camera - 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-camera

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

nativephp/mobile-camera
=======================

Camera plugin for NativePHP Mobile (Photo capture, Video recording, Gallery picker)

1.0.1(2mo ago)61.9k—3.8%6[2 PRs](https://github.com/NativePHP/mobile-camera/pulls)MITKotlinPHP ^8.2

Since Jan 19Pushed 1mo agoCompare

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

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Camera Plugin for NativePHP Mobile
==================================

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

Camera plugin for NativePHP Mobile providing photo capture, video recording, and gallery picker functionality.

Overview
--------

[](#overview)

The Camera API provides access to the device's camera for taking photos, recording videos, and selecting media from the gallery.

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

[](#installation)

```
composer require nativephp/mobile-camera
```

Don't forget to register the plugin:

```
php artisan native:plugin:register nativephp/mobile-camera
```

Usage
-----

[](#usage)

### PHP (Livewire/Blade)

[](#php-livewireblade)

```
use Native\Mobile\Facades\Camera;

// Take a photo
Camera::getPhoto();

// Record a video
Camera::recordVideo();

// Record with max duration
Camera::recordVideo(['maxDuration' => 30]);

// Using fluent API
Camera::recordVideo()
    ->maxDuration(60)
    ->id('my-video-123')
    ->start();

// Pick images from gallery
Camera::pickImages('images', false);  // Single image
Camera::pickImages('images', true);   // Multiple images
Camera::pickImages('all', true);      // Any media type
```

### JavaScript (Vue/React/Inertia)

[](#javascript-vuereactinertia)

```
import { Camera, On, Off, Events } from '#nativephp';

// Take a photo
await Camera.getPhoto();

// With identifier for tracking
await Camera.getPhoto()
    .id('profile-pic');

// Record video
await Camera.recordVideo()
    .maxDuration(60);

// Pick images
await Camera.pickImages()
    .images()
    .multiple()
    .maxItems(5);
```

Events
------

[](#events)

### `PhotoTaken`

[](#phototaken)

Fired when a photo is taken with the camera.

#### PHP

[](#php)

```
use Native\Mobile\Attributes\OnNative;
use Native\Mobile\Events\Camera\PhotoTaken;

#[OnNative(PhotoTaken::class)]
public function handlePhotoTaken(string $path)
{
    // Process the captured photo
    $this->processPhoto($path);
}
```

#### Vue

[](#vue)

```
import { On, Off, Events } from '#nativephp';
import { ref, onMounted, onUnmounted } from 'vue';

const photoPath = ref('');

const handlePhotoTaken = (payload) => {
    photoPath.value = payload.path;
    processPhoto(payload.path);
};

onMounted(() => {
    On(Events.Camera.PhotoTaken, handlePhotoTaken);
});

onUnmounted(() => {
    Off(Events.Camera.PhotoTaken, handlePhotoTaken);
});
```

### `VideoRecorded`

[](#videorecorded)

Fired when a video is successfully recorded.

**Payload:**

- `string $path` - File path to the recorded video
- `string $mimeType` - Video MIME type (default: `'video/mp4'`)
- `?string $id` - Optional identifier if set via `id()` method

### `VideoCancelled`

[](#videocancelled)

Fired when video recording is cancelled by the user.

### `MediaSelected`

[](#mediaselected)

Fired when media is selected from the gallery.

```
use Native\Mobile\Attributes\OnNative;
use Native\Mobile\Events\Gallery\MediaSelected;

#[OnNative(MediaSelected::class)]
public function handleMediaSelected($success, $files, $count)
{
    foreach ($files as $file) {
        $this->processMedia($file);
    }
}
```

PendingVideoRecorder API
------------------------

[](#pendingvideorecorder-api)

### `maxDuration(int $seconds)`

[](#maxdurationint-seconds)

Set the maximum recording duration in seconds.

### `id(string $id)`

[](#idstring-id)

Set a unique identifier for this recording to correlate with events.

### `event(string $eventClass)`

[](#eventstring-eventclass)

Set a custom event class to dispatch when recording completes.

### `remember()`

[](#remember)

Store the recorder's ID in the session for later retrieval.

### `start()`

[](#start)

Explicitly start the video recording.

Storage Locations
-----------------

[](#storage-locations)

**Photos:**

- **Android:** App cache directory at `{cache}/captured.jpg`
- **iOS:** Application Support at `~/Library/Application Support/Photos/captured.jpg`

**Videos:**

- **Android:** App cache directory at `{cache}/video_{timestamp}.mp4`
- **iOS:** Application Support at `~/Library/Application Support/Videos/captured_video_{timestamp}.mp4`

Notes
-----

[](#notes)

- **Permissions:** You must enable the `camera` permission in `config/nativephp.php` to use camera features
- If permission is denied, camera functions will fail silently
- Camera permission is required for photos, videos, AND QR/barcode scanning
- File formats: JPEG for photos, MP4 for videos

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance88

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.5% 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 ~41 days

Total

2

Last Release

78d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

nativephpnativephp-mobilenativephp-plugin

### Embed Badge

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

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

PHPackages © 2026

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