rajen/nativephp-url-launcher 问题修复 & 功能扩展

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

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

rajen/nativephp-url-launcher

最新稳定版本:v1.0.2

Composer 安装命令:

composer require rajen/nativephp-url-launcher

包简介

Native external URL and deep link launcher for NativePHP applications.

README 文档

README

A NativePHP Mobile plugin for communicating with device functionalities like the browser, phone dialer, SMS, map apps, and deep linking schemes.

Similar to Flutter's url_launcher, but tailored for NativePHP mobile.

Browser functionalities are already provided by NativePHP, so this plugin is only for other functionalities, for browser functionalities use NativePHP Mobile Borwser

Requirements

  • PHP 8.2+
  • Laravel 11+
  • NativePHP Mobile ^3.0

Installation

composer require rajen/nativephp-url-launcher

Publish the configuration file:

php artisan vendor:publish --tag="nativephp-url-launcher-config"

Basic Usage

The plugin exposes a Laravel Facade, making it extremely easy to use:

use Rajen\UrlLauncher\Facades\UrlLauncher;


// Send an email
UrlLauncher::openEmail('hello@nativephp.com', 'Support Request', 'Hello from my app!');

// Dial a phone number
UrlLauncher::openPhone('+1234567890');

// Send an SMS
UrlLauncher::openSms('+1234567890', 'Please reply to this message.');

// Open WhatsApp
UrlLauncher::openWhatsApp('+1234567890', 'Hello!');

// Open Maps
UrlLauncher::openMap('London, UK');

// Open custom app deep link
UrlLauncher::openCustomScheme('myapp://product/123');

// Check if a URL can be launched
if (UrlLauncher::canLaunch('twitter://user?screen_name=NativePHP')) {
    UrlLauncher::launch('twitter://user?screen_name=NativePHP');
}

Deep Linking Configuration

If your app needs to trigger external deep links (e.g. twitter://, whatsapp://) or needs to handle returns back into your app via Custom Schemes (myapp://), you must configure the native project manifests.

Android Setup (AndroidManifest.xml)

Add the following <queries> to your manifest if you are targeting Android 11+ to canLaunch other apps:

<manifest package="com.your.app">
    <queries>
        <!-- For WhatsApp -->
        <package android:name="com.whatsapp" />
        
        <!-- For Emails -->
        <intent>
            <action android:name="android.intent.action.SENDTO" />
            <data android:scheme="mailto" />
        </intent>

        <!-- For Custom apps -->
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="twitter" />
        </intent>
    </queries>
</manifest>

iOS Setup (Info.plist)

For iOS, you need to whitelist URL schemes your app wants to open using LSApplicationQueriesSchemes.

Add this to your Info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>whatsapp</string>
    <string>twitter</string>
    <string>mailto</string>
    <string>tel</string>
    <string>sms</string>
</array>

Listening for Returns / Deep Links

You can listen to URL Launcher events using standard Laravel Event listeners:

  • Rajen\UrlLauncher\Events\UrlLaunched
  • Rajen\UrlLauncher\Events\UrlLaunchFailed
  • Rajen\UrlLauncher\Events\DeepLinkReceived
  • Rajen\UrlLauncher\Events\UrlLaunchCompleted
  • Illuminate\Support\Facades\Event

Example:

use Rajen\UrlLauncher\Events\UrlLaunched;
use Rajen\UrlLauncher\Events\UrlLaunchFailed;
use Rajen\UrlLauncher\Events\DeepLinkReceived;
use Rajen\UrlLauncher\Events\UrlLaunchCompleted;
use Illuminate\Support\Facades\Event;

Event::listen(function (DeepLinkReceived $event) {
    // do something
});

License

MIT

Support

For questions, feature requests, or issues, please contact laravel.rajen@gmail.com.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固