Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
Adding available methods to README
Browse files Browse the repository at this point in the history
Fixes #1
  • Loading branch information
S1SYPHOS committed Mar 17, 2018
1 parent 0a839ce commit f21a054
Showing 1 changed file with 86 additions and 34 deletions.
120 changes: 86 additions & 34 deletions README.md
Expand Up @@ -4,13 +4,15 @@
This plugin detects devices (such as desktop, tablet, mobile, tv, cars, console, ..), clients (browsers, feed readers, media players, PIMs, ..) as well as operating systems, brands and models.

**Table of contents**
- [1. Use cases](#use-cases)
- [1. Main features](#main-features)
- [2. Getting started](#getting-started)
- [3. Configuration](#configuration)
- [4. Credits / License](#credits--license)
- [4. Available methods](#available-methods)
- [5. Examples](#examples)
- [6. Credits / License](#credits--license)

## Use cases
`kirby-detect` provides the `device()` function which instantiates a new instance of the DeviceDetector class, which is able to identify
## Main features
`kirby-device` provides the `device()` function for parsing information from the target's user agent (UA) - the [black-magic voodoo science of regular expressions](https://blogs.perficient.com/perficientdigital/2017/12/04/the-magic-of-regex-an-intro-to-regular-expressions) then enables you to identify

- [operating systems](https://github.com/matomo-org/device-detector#list-of-detected-operating-systems))
- [browsers](https://github.com/matomo-org/device-detector#list-of-detected-browsers))
Expand All @@ -22,6 +24,86 @@ This plugin detects devices (such as desktop, tablet, mobile, tv, cars, console,
- [brands & devices](https://github.com/matomo-org/device-detector#list-of-brands-with-detected-devices)
- .. and of course: [bots](https://github.com/matomo-org/device-detector#list-of-detected-bots)

## Getting started
Use one of the following methods to install & use `kirby-device`:

### Git submodule
If you know your way around Git, you can download this plugin as a [submodule](https://github.com/blog/2104-working-with-submodules):

```text
git submodule add https://github.com/S1SYPHOS/kirby-device.git site/plugins/kirby-device
```

### Clone or download
1. [Clone](https://github.com/S1SYPHOS/kirby-device.git) or [download](https://github.com/S1SYPHOS/kirby-device/archive/master.zip) this repository.
2. Unzip / Move the folder to `site/plugins`.

### Activate the plugin
Activate the plugin with the following line in your `config.php`:

```text
c::set('plugin.kirby-device', true);
```

## Configuration
Change `kirby-device` options to suit your needs:

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `plugin.kirby-device.truncate-version` | String | `minor` | Defines the browser build or version format according to the [semantic versioning](https://semver.org/) specification (allowed values are `major`, `minor`, `patch` as well as `build` & `none`). |

TO BE CONTINUED

## Available methods
These methods are available to meet your device detection requirements:

```php
// Configuration Methods
setCache()
setYamlParser()
discardBotInformation()
skipBotDetection()

// General Device Type Methods
isBot()
isMobile()
isDesktop()
isTouchEnabled() (win8 tablets only)

// General Client Type Methods
getBot() array
getClient() array|string (attr passed)
getOs() array|string (attr passed)
getDevice()
getDeviceName()
getBrand()
getBrandName()
getModel()
getUserAgent()

// Specific Device Type Methods
isSmartphone()
isFeaturePhone()
isTablet()
isPhablet()
isConsole()
isPortableMediaPlayer()
isCarBrowser()
isTV()
isSmartDisplay()
isCamera()

// Specific Client Type Methods
isBrowser()
isFeedReader()
isMobileApp()
isPIM()
isLibrary()
isMediaPlayer()
```

## Examples

### Check for mobile environment

```php
Expand Down Expand Up @@ -71,36 +153,6 @@ function isChrome() {

For more information, see the [project's repo](https://github.com/serbanghita/Mobile-Detect) or check out its [demo page](http://devicedetector.net/index.php).

## Getting started
Use one of the following methods to install & use `kirby-device`:

### Git submodule
If you know your way around Git, you can download this plugin as a [submodule](https://github.com/blog/2104-working-with-submodules):

```text
git submodule add https://github.com/S1SYPHOS/kirby-device.git site/plugins/kirby-device
```

### Clone or download
1. [Clone](https://github.com/S1SYPHOS/kirby-device.git) or [download](https://github.com/S1SYPHOS/kirby-device/archive/master.zip) this repository.
2. Unzip / Move the folder to `site/plugins`.

### Activate the plugin
Activate the plugin with the following line in your `config.php`:

```text
c::set('plugin.kirby-device', true);
```

## Configuration
Change `kirby-device` options to suit your needs:

TODO

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `plugin.kirby-device.truncate-version` | String | `minor` | Defines the browser build or version format according to the [semantic versioning](https://semver.org/) specification (allowed values are `major`, `minor`, `patch` as well as `build` & `none`). |

## Credits / License
`kirby-device` is based on Matomo's [DeviceDetector](https://github.com/matomo-org/device-detector) and was inspired by [Sonja Broda](https://github.com/texnixe)'s Kirby plugin [kirby-mobile-detect](https://github.com/texnixe/kirby-mobile-detect) (an implementation of Şerban Ghiţă's [Mobile-Detect](https://github.com/serbanghita/Mobile-Detect)). It is licensed under the [MIT License](LICENSE), but **using Kirby in production** requires you to [buy a license](https://getkirby.com/buy). Are you ready for the [next step](https://getkirby.com/next)?

Expand Down

0 comments on commit f21a054

Please sign in to comment.