项目作者: mattsparks

项目描述 :
Redirect your users to your app in the appropriate app store.
高级语言: PHP
项目地址: git://github.com/mattsparks/appstoreredirect.git
创建时间: 2018-02-07T17:04:12Z
项目社区:https://github.com/mattsparks/appstoreredirect

开源协议:MIT License

下载


App Store Redirect

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:

  1. composer require mattsparks/appstoreredirect

Example Usage

  1. <?php
  2. require __DIR__ . '/vendor/autoload.php';
  3. use AppStoreRedirect\AppStoreRedirect;
  4. $config = [
  5. 'platforms' => [
  6. 'iOS' => [
  7. 'path' => 'https://itunes.apple.com/us/app/example-app-name/id1234567890',
  8. 'message' => 'Sending you to the Apple App Store',
  9. ],
  10. 'androidos' => [
  11. 'path' => 'https://play.google.com/store/apps/details?id=com.example.app',
  12. 'message' => 'Sending you to the Google Play Store',
  13. ],
  14. ],
  15. 'delay' => 5,
  16. 'fallback' => [
  17. 'path' => 'http://example.com',
  18. ],
  19. ];
  20. $redirect = new AppStoreRedirect($config);
  21. $redirect->run();

Configuration

Option Values Description
platform iOS, androidos The platform being targeted. A path is required, message is optional.
delay 0 - ? Number of seconds to delay redirect. optional
fallback path A fallback path should a platform not be matched. optional

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.