Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mattsparks/appstoreredirect

Redirect your users to your app in the appropriate app store.
https://github.com/mattsparks/appstoreredirect

android-app app apple appstore google-play-store ios ios-app redirect

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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:
```bash
composer require mattsparks/appstoreredirect
```

## Example Usage
```php
[
'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

| 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](https://github.com/serbanghita/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](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)
2. Create a feature branch.
3. Send a pull request.