Code Monkey home page Code Monkey logo

identify's Introduction

Identify

Laravel 6 Package to identify a User's Browser, Operating System, Language and Device, forked from consoletvs/identify

NOTE: Works on the latest laravel version

Installation

PHP 5.4+ or HHVM 3.3+, and Composer are required.

To get the latest version of Laravel Identify, simply add the following line to the require block of your composer.json file.

composer require luizjr/identify

You'll then need to run composer install or composer update to download it and have the autoloader updated.

Once Laravel Identify is installed, you need to register the service provider. Open up config/app.php and add the following to the providers key.

  • LuizJr\Identify\IdentifyServiceProvider::class

Also, register the Facade like so:

'aliases' => [
    ...
    'Identify' => LuizJr\Identify\Facades\IdentityFacade::class,
    ...
]

Configuration

To get started, you'll need to publish all vendor assets:

$ php artisan vendor:publish --provider="LuizJr\Identify\IdentifyServiceProvider"

Browser Detection

The browser method allows you to detect a user's browser and version.

Browsers Detected

  • Vivaldi
  • Opera
  • Opera Mini
  • WebTV
  • Internet Explorer
  • Pocket Internet Explorer
  • Microsoft Edge
  • Konqueror
  • iCab
  • OmniWeb
  • Firebird
  • Firefox
  • Iceweasel
  • Shiretoko
  • Mozilla
  • Amaya
  • Lynx
  • Safari
  • Chrome
  • Navigator
  • GoogleBot
  • Yahoo! Slurp
  • W3C Validator
  • BlackBerry
  • IceCat
  • Nokia S60 OSS Browser
  • Nokia Browser
  • MSN Browser
  • MSN Bot
  • Netscape Navigator
  • Galeon
  • NetPositive
  • Phoenix
  • SeaMonkey
  • Yandex Browser

Usage

/**
 * Gets the version of the user's browser
 * @return string
 */
Identify::browser()->getVersion()

/**
 * Gets the name of the user's browser
 * @return string
 */
Identify::browser()->getName()

OS Detection

The os method allows you to detect a user's operating system and version.

OS Detected

  • Windows
  • Windows Phone
  • OS X
  • iOS
  • Android
  • Chrome OS
  • Linux
  • SymbOS
  • Nokia
  • BlackBerry
  • FreeBSD
  • OpenBSD
  • NetBSD
  • OpenSolaris
  • SunOS
  • OS2
  • BeOS

Usage

/**
 * Gets the version of the user's Operating System
 * @return string
 */
Identify::os()->getVersion()

/**
 * Gets the name of the user's Operating System
 * @return string
 */
Identify::os()->getName()

Device Detection

The device method allows you to detect a user's device.

Device Detected

  • iPad
  • iPhone
  • Windows Phone

Usage

/**
 * Gets the name of the user's device
 * @return string
 */
Identify::device()->getName()

Language Detection

The language method allows you to detect a user's language.

Usage

/**
 * Gets the language that the user's browser contents are displayed in
 * @return string
 */
Identify::lang()->getLanguage()

Contributing

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

How can I thank you?

Why not star the github repo? I'd love the attention! Why not share the link for this repository on Twitter or HackerNews? Spread the word!

Don't forget to follow me on twitter!

Thanks! Luiz Jr.

License

The MIT License (MIT). Please see License File for more information.

identify's People

Contributors

consoletvs avatar luizjr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.