Coder Social home page Coder Social logo

larinfo's Introduction

Larinfo

Build Status Total Download Latest Stable Version

Larinfo provide system information for Laravel 5.x application. It show IP address information for host and client, server software versions, and hardware information.

Installation

To install using Composer, just run this command below.

composer require matriphe/larinfo

For Laravel 5.0, 5.1, 5.2, 5.3, and 5.4

Open the config/app.php and add this line in providers section.

Matriphe\Larinfo\LarinfoServiceProvider::class,

Still on config/app.php file, add this line in aliases section.

'Larinfo' => Matriphe\Larinfo\LarinfoFacade::class,

For Laravel 5.5

Nothing to do. It uses Laravel's package auto discovery.

Usage

To get all info, use getInfo() method. It will return this array example.

$larinfo = Larinfo::getInfo();

Result of that command is shown below.

$larinfo = [
   'host'=> [
       'city'=> '104.20.8.94',
       'country'=> 'US',
       'hostname'=> '',
       'ip'=> '104.20.8.94',
       'loc'=> '37.7697,-122.3933',
       'org'=> 'AS13335 Cloudflare, Inc.',
       'phone'=> '',
       'postal'=> '94107',
       'region'=> ''
   ],
   'client'=> [
       'city'=> 'Bekasi',
       'country'=> 'ID',
       'hostname'=> '',
       'ip'=> '180.252.202.108',
       'loc'=> '-6.2349,106.9896',
       'org'=> 'AS17974 PT Telekomunikasi Indonesia',
       'phone'=> '',
       'postal'=> '',
       'region'=> ''
   ],
   'server'=> [
       'software'=> [
           'os'=> 'Darwin (macOS 10.12.6 )',
           'distro'=> '',
           'kernel'=> '16.7.0',
           'arc'=> 'x86_64',
           'webserver'=> 'nginx/1.12.0',
           'php'=> '7.0.20'
       ],
       'hardware'=> [
           'cpu'=> 'Intel® Core™ i5-3210M CPU @ 2.50GHz',
           'cpu_count'=> 4,
           'model'=> 'MacBook Pro',
           'virtualization'=> '',
           'ram'=> [
               'total'=> 8589934592,
               'free'=> 8578883584
           ],
           'swap'=> [
               'total'=> 4294967296,
               'free'=> 747110400
           ],
           'disk'=> [
               'total'=> 754593608704,
               'free'=> 265534066688
           ]
       ],
       'uptime'=> [
           'uptime'=> '4 days, 8 hours, 38 seconds',
           'booted_at'=> '2017-07-28 07:12:21'
       ]
   ],
   'database'=> [
       'driver'=> 'MySQL',
       'version'=> '5.7.18'
   ]
]

Other method you can use are:

  • getHostIpinfo to get host IP info (Larinfo::getHostIpinfo())
  • getClientIpinfo to get client IP info (Larinfo::getClientIpinfo())
  • getServerInfoSoftware to get server software info (Larinfo::getServerInfoSoftware())
  • getServerInfoHardware to get server hardware info (Larinfo::getServerInfoHardware())
  • getUptime to get server uptime (Larinfo::getUptime())
  • getServerInfo to get server info (Larinfo::getServerInfo())
  • getDatabaseInfo to get database info (Larinfo::getDatabaseInfo())

Config

IP information is taken using ipinfo.io service. If you've registered and has token access, put your token in the config/services.php in ipinfo variable.

'ipinfo' => [
	'token'  => 'your_ipinfo_token',
],

If you don't want to hit ipinfo.io rate limit, you can cache it using Laravel built-in cache.

License

The GPLv3 License. Please see License File for more information.

larinfo's People

Contributors

matriphe avatar

Stargazers

rathakann avatar

Watchers

James Cloos avatar

Forkers

rathakanndev

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.