PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Moamen Eltouny   pharaoh PHP Client Detection   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: pharaoh PHP Client Detection
Detect the current HTTP request browser type
Author: By
Last change:
Date: 4 years ago
Size: 2,051 bytes
 

Contents

Class file image Download

[PHP] Pharaoh Client

Latest Stable Version Total Downloads License

Pharaoh-Client provides a quick and easy controlling of Client Information [Visitor]

Install

Install the latest version using Composer:

$ composer require raggitech/pharaoh-client

then include the vendor autoload file.

Usage

Getting the Instances:

$client = \Pharaoh\Client::getInstance();

<a name="client"></a>

Client


##############################
# Bot
##############################
// check if it's a bot
var_dump($client->isBot());

// get the bot's name
echo $client->bot();

##############################
# Main Information
##############################

// get user agent
echo $client->agent;

// get user ip
echo $client->ip;

// get referer
echo $client->referer;

// get user languages list
echo $client->languages;

// get user language
echo $client->language;

// get user language's variant
echo $client->variant;

##############################
# Device
##############################
$device = $client->device;

// Browser Engine name
echo $device->name; // WebKit

// Browser (name, version)
echo $device->browser->name; // Chrome
echo $device->browser->version; // 77.0.3865.120

// Platform (name, version)
echo $device->platform->name; // Windows
echo $device->platform->version; // 10.0


// Device Type
var_dump($device->isDesktop); // true

// if it's a phone
if($device->isPhone){
    var_dump(
        $device->isMobile, // true
        $device->isTablet, // false
        
        $device->isiOS, // true
        $device->isAndroid, // false
    );
}

License

MIT license