Save remote images and videos directly to the device photo library (camera roll on iOS, MediaStore gallery on Android) from a NativePHP Mobile app — no share sheet, no extra taps.
composer require voicecode-bv/mobile-photosAfter install, register the plugin so it gets compiled into the native projects:
php artisan native:plugin:register voicecode-bv/mobile-photosThen rebuild the iOS and Android projects through the usual NativePHP build flow.
The plugin manifest declares NSPhotoLibraryAddUsageDescription. You can override the prompt copy by setting your own value in nativephp/ios/NativePHP/Info.plist — the plugin compiler will not overwrite a key that already exists.
The plugin uses iOS' add-only authorization (PHAccessLevel.addOnly), which means users don't have to give full photo library access just to save a single file.
Requires Android 10 (API 29) or higher. Saves go through MediaStore so no runtime storage permission is needed.
use Voicecode\Mobile\Photos\Photos;
app(Photos::class)->save('https://cdn.example.com/photo.jpg');
app(Photos::class)->save('https://cdn.example.com/clip.mp4', 'video');import { BridgeCall } from '@nativephp/mobile';
const result = await BridgeCall('Photos.Save', {
url: 'https://cdn.example.com/photo.jpg',
// type is optional — inferred from the URL extension when omitted.
type: 'image',
});
if (result?.status === 'saved') {
// saved to camera roll / gallery
}The call returns synchronously once the asset has been written. On failure the response carries a code and message (PERMISSION_DENIED, EXECUTION_FAILED, INVALID_PARAMETERS).
MIT