2017 © Pedro Peláez
 

library laravel51-provider

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

image

handsetdetection/laravel51-provider

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

  • Tuesday, June 7, 2016
  • by elricho
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,462 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

Laravel 5.1 LTS Wrapper for Handset Detection

A minimal service provider to set up and use the Handset Detection 4.x PHP library in Laravel v5.1 LTS., (*1)

Usage example

/**
 * Where $httpHeaders is a key=>value array of headers, for example :
 *     array(
 *         'user-agent' => "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; fr_FR) AppleWebKit (KHTML, like Gecko) Mobile"
 *     )
 **/
$hd = App('HandsetDetection');
$hd->deviceDetect($httpHeaders);

Call any of the Handset Detection 4.x PHP library methods in this same fashion. Additional examples at PHP APIKit Home ., (*2)

$hd->deviceVendors();
$hd->deviceModels('Nokia');
$hd->deviceWhatHas('network', 'EDGE');
$hd->deviceFetchArchive();
$hd->communityFetchArchive();

Here's a snippet that ties it all together with a few sample detections., (*3)

$data = array (
    array (
        'user-agent' => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
    ),
    array (
        'user-agent' => "Mozilla/5.0 (Linux; U; Android 2.3.6; en-us; SAMSUNG-SGH-I577 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
    ),
    array (
        'user-agent' => "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; fr_FR) AppleWebKit (KHTML, like Gecko) Mobile [FBAN/FBForIPhone;FBAV/4.0.2;FBBV/4020.0;FBDV/iPhone3,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/4.3.3;FBSS/2; FBCR/TELUS;FBID/phone;FBLC/fr_FR;FBSF/2.0]"
    ),
    array (
        'user-agent' => "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; fr_FR) AppleWebKit (KHTML, like Gecko) Mobile",
        'x-local-hardwareinfo' => "480:320:275:200"
    )
);

$hd = App('HandsetDetection');
foreach ($data as $headers) {
    $return = $hd->deviceDetect($headers);
    $reply = $hd->getReply();
    $this->info(json_encode($reply));
}

Setup

Step 1: Adding the dependency to composer.json

Add this to your composer.json. This will also fetch, (*4)

"require": {
    "handsetdetection/laravel51-provider": "1.*",
}

Step 2: Register the service provider

Register the service provider in config/app.php by inserting into the providers array, (*5)

'providers' => [
    HandsetDetection\Laravel51Provider\HandsetDetectionServiceProvider::class,
]

Step 3: From the command-line run

php artisan vendor:publish --provider="HandsetDetection\Laravel51Provider\HandsetDetectionServiceProvider"

This will publish config/handsetdetection.php to your config folder., (*6)

Step 4: Edit your config file

Place your Handset Detection access credentials in the config file., (*7)

Job Done., (*8)

Let us know if you have any hassles : hello@handsetdetection.com, (*9)

Happy Detecting :-), (*10)

The Versions

07/06 2016

dev-master

9999999-dev

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

  Sources   Download

MIT

The Requires

 

07/06 2016

1.0.4

1.0.4.0

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

  Sources   Download

MIT

The Requires

 

06/06 2016

1.0.2

1.0.2.0

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

  Sources   Download

MIT

The Requires

 

06/06 2016

1.0.1

1.0.1.0

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

  Sources   Download

MIT

The Requires

 

06/06 2016

1.0.0

1.0.0.0

A Laravel 5.1 service provider for the HandsetDetection v4.x PHP API kit

  Sources   Download

MIT

The Requires