mattsparks/appstoreredirect

Redirect your users to your app in the appropriate app store.

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

This package is auto-updated.

Last update: 2024-11-24 06:20:13 UTC


README

Have an app that you need to direct your users to? Send them to the correct app store with this handy class. Requires PHP 7+.

Install

Via composer:

composer require mattsparks/appstoreredirect

Example Usage

<?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();

Configuration

Note: Other platforms are likely supported. Under the hood this uses Mobile Detect to determine the platform being used. I've only tested iOS and Android so far and can only vouch for those.

Contribute

Contributions are very welcome!

  1. Follow the PSR-2 Standard
  2. Create a feature branch.
  3. Send a pull request.