Download the PHP package nativephp/mobile-camera without Composer
On this page you can find all versions of the php package nativephp/mobile-camera. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nativephp/mobile-camera
More information about nativephp/mobile-camera
Files in nativephp/mobile-camera
Package mobile-camera
Short Description Camera plugin for NativePHP Mobile (Photo capture, Video recording, Gallery picker)
License MIT
Informations about the package mobile-camera
Camera Plugin for NativePHP Mobile
Camera plugin for NativePHP Mobile providing photo capture, video recording, and gallery picker functionality.
Overview
The Camera API provides access to the device's camera for taking photos, recording videos, and selecting media from the gallery.
Installation
Don't forget to register the plugin:
Usage
PHP (Livewire/Blade)
JavaScript (Vue/React/Inertia)
Events
PhotoTaken
Fired when a photo is taken with the camera.
PHP
Vue
VideoRecorded
Fired when a video is successfully recorded.
Payload:
string $path- File path to the recorded videostring $mimeType- Video MIME type (default:'video/mp4')?string $id- Optional identifier if set viaid()method
VideoCancelled
Fired when video recording is cancelled by the user.
MediaSelected
Fired when media is selected from the gallery.
PendingVideoRecorder API
maxDuration(int $seconds)
Set the maximum recording duration in seconds.
id(string $id)
Set a unique identifier for this recording to correlate with events.
event(string $eventClass)
Set a custom event class to dispatch when recording completes.
remember()
Store the recorder's ID in the session for later retrieval.
start()
Explicitly start the video recording.
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
Testing
The plugin extends the NativePHP testing suite with camera-specific helpers, so your app tests can assert capture/recording/picker activity without knowing any bridge internals.
getPhoto(), recordVideo(), and pickImages() only open the native camera or gallery UI — the result (PhotoTaken, VideoRecorded, MediaSelected, or a cancellation/permission-denied counterpart) arrives later as an async event that the bridge never answers synchronously. So these helpers assert that a request was made; there's no with* helper to preload a captured photo or picked media.
Helpers
assertPhotoRequested()— assert a photo capture was started (Camera::getPhoto()->start()).assertVideoRequested()— assert a video recording was started (Camera::recordVideo()->start()).assertMediaPicked(?callable $filter = null)— assert the gallery picker was opened, optionally matching the decoded call params (e.g.mediaType,multiple,maxItems).assertNothingCaptured()— assert no photo, video, or media picker request was made.
The helpers are available on Native::fakeBridge() and chain directly off Native::test(...). They register automatically while running tests (requires a core with a macroable FakeBridge; on older cores they simply don't register).
Notes
- Permissions: You must enable the
camerapermission inconfig/nativephp.phpto 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