mattsparks/appstoreredirect

将用户重定向到适当的App Store中的应用程序。

dev-master 2018-02-07 23:42 UTC

This package is auto-updated.

Last update: 2024-09-24 05:46:01 UTC


README

你有需要将用户引导到应用的情况吗?使用这个方便的类将他们发送到正确的应用商店。需要PHP 7以上。

安装

通过composer

composer require mattsparks/appstoreredirect

示例用法

<?php
require __DIR__ . '/vendor/autoload.php';

use AppStoreRedirect\AppStoreRedirect;

$config = [
    'platforms' => [
        'iOS' => [
            'path' => 'https://itunes.apple.com/us/app/example-app-name/id1234567890',
            'message' => 'Sending you to the Apple App Store',
        ],
        'androidos' => [
            'path' => 'https://play.google.com/store/apps/details?id=com.example.app',
            'message' => 'Sending you to the Google Play Store',            
        ],
    ],
    'delay' => 5,
    'fallback' => [
        'path' => 'http://example.com',
    ],
];

$redirect = new AppStoreRedirect($config);
$redirect->run();

配置

注意:可能支持其他平台。在底层,它使用Mobile Detect来确定正在使用的平台。到目前为止,我仅测试了iOS和Android,只能对这些平台负责。

贡献

非常欢迎贡献!

  1. 遵循PSR-2标准
  2. 创建功能分支。
  3. 发送pull请求。