nativephp/mobile-share 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nativephp/mobile-share

Composer 安装命令:

composer require nativephp/mobile-share

包简介

Native share sheet plugin for NativePHP Mobile

README 文档

README

Native share sheet for sharing URLs and files in NativePHP Mobile applications.

Overview

The Share API provides cross-platform native share sheet functionality for sharing URLs, text, and files.

Installation

composer require nativephp/mobile-share

Usage

Share a URL

PHP (Livewire/Blade)

use Native\Mobile\Facades\Share;

// Share a URL with title and text
Share::url('Check this out!', 'Found this great article', 'https://example.com');

JavaScript (Vue/React/Inertia)

import { Share } from '#nativephp';

// Share a URL
await Share.url('Check this out!', 'Found this great article', 'https://example.com');

Share a File

PHP

use Native\Mobile\Facades\Share;

// Share a file
Share::file('My Recording', 'Listen to this!', '/path/to/audio.m4a');

// Share just text (no file)
Share::file('Hello', 'This is my message', '');

JavaScript

import { Share } from '#nativephp';

// Share a file
await Share.file('My Recording', 'Listen to this!', '/path/to/audio.m4a');

// Share just text
await Share.file('Hello', 'This is my message');

Methods

url(string $title, string $text, string $url)

Opens the native share sheet with a URL.

Parameter Type Description
title string Share dialog title / subject
text string Text message to include with the URL
url string The URL to share

file(string $title, string $text, string $filePath)

Opens the native share sheet with a file or text.

Parameter Type Description
title string Share dialog title / subject
text string Text message to share
filePath string Absolute path to file (optional)

Supported File Types

The share sheet automatically detects MIME types for common file formats:

Audio: m4a, aac, mp3, wav, ogg, flac Video: mp4, m4v, mov, avi, mkv, webm Images: jpg, jpeg, png, gif, webp Documents: pdf, txt

Platform Behavior

Android

  • Uses Intent.ACTION_SEND with Intent.createChooser
  • Files are shared via FileProvider for security
  • Temporary copies are made for files in app storage
  • Old share temp files are automatically cleaned up

iOS

  • Uses UIActivityViewController
  • Supports iPad popover presentation
  • Files are shared directly via file URLs

统计信息

  • 总下载量: 4.9k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 4
  • 开发语言: Kotlin

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固