matriphe/larinfo
Composer 安装命令:
composer require matriphe/larinfo
包简介
Display system information (IP address, OS, versions) for Laravel.
README 文档
README
Larinfo provide system information for Laravel.
It wraps Linfo to show IP address information on the server and client side, server software versions, and hardware information.
Requirements
- PHP version:
^8.2. - Laravel version:
^11.0.
For Windows User
It is recommended to enable com_dotnet extension to get more accurate information.
In your php.ini file, add this line, and make sure you have php_com_dotnet.dll in your PHP ext directory.
extension=com_dotnet
Installation
To install using Composer, just run this command below.
composer require matriphe/larinfo
Versions
| Larinfo | Laravel | Composer Command |
|---|---|---|
| 2.2 | 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, and 5.6 |
composer require matriphe/larinfo:2.2 |
| 3.0.0 | 5.7.*, 5.8.*, ^6.0, ^7.0, and ^8.0 |
composer require matriphe/larinfo:3.0.0 |
| 4.0.0 | ^9.0 |
composer require matriphe/larinfo:4.0.0 |
| 4.1.0 | ^10.0 |
composer require matriphe/larinfo:4.1.0 |
| latest (4.2.0) | ^11.0 |
composer require matriphe/larinfo |
Configuration
To publish the config (optional) run this command below.
php artisan vendor:publish
Then select the number that points to Matriphe\Larinfo\LarinfoServiceProvider provider.
The new config will be placed in config/larinfo.php.
Service Configuration
IP address information is taken using ipinfo.io service. If you've registered and has access token, put your token in the config/services.php inside the ipinfo variable.
'ipinfo' => [ 'token' => 'your_ipinfo_token', ]
If you don't want to hit ipinfo.io rate limit, it is recommended to cache it using Laravel built-in cache.
Usage
To get all info, use facade Larinfo and call the getInfo() method. It will return this array example.
use Larinfo; $larinfo = Larinfo::getInfo();
The result of that command is shown below.
$larinfo = [ 'host'=> [ 'city'=> 'San Francisco', 'country'=> 'US', 'hostname'=> '', 'ip'=> '104.20.8.94', 'loc'=> '37.7697,-122.3933', 'org'=> 'AS13335 Cloudflare, Inc.', 'phone'=> '', 'postal'=> '94107', 'region'=> 'California', 'timezone' => 'America/Los_Angeles', ], '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'=> 'MacOS', 'distro'=> 'MacOS 10.15.7', 'kernel'=> '19.6.0', 'arc'=> 'x86_64', 'webserver'=> 'nginx/1.19.8', 'php'=> '8.0.3' ], 'hardware'=> [ 'cpu'=> 'Intel® Core™ i5-3210M CPU @ 2.50GHz', 'cpu_count'=> 4, 'model'=> 'Apple device', 'virtualization'=> '', 'ram'=> [ 'total'=> 8589934592, 'free'=> 8578883584, 'human_total' => '8.0 GiB', 'human_free' => '15.0 MiB', ], 'swap'=> [ 'total'=> 2147483648, 'free'=> 426246144, 'human_total' => '2.0 GiB', 'human_free' => '406.5 MiB', ], 'disk'=> [ 'total'=> 2999590176768, 'free'=> 1879852326912, 'human_total' => '2.7 TiB', 'human_free' => '1.7 TiB', ] ], 'uptime'=> [ 'uptime'=> '2 days, 12 hours, 13 minutes, 43 seconds', 'booted_at'=> '2021-04-02 15:27:54' ] ], 'database'=> [ 'driver'=> 'MySQL', 'version'=> '8.0.22' ] ];
Other method you can use are:
getHostIpinfoto get host IP info (Larinfo::getHostIpinfo())getClientIpinfoto get client IP info (Larinfo::getClientIpinfo())getServerInfoSoftwareto get server software info (Larinfo::getServerInfoSoftware())getServerInfoHardwareto get server hardware info (Larinfo::getServerInfoHardware())getUptimeto get server uptime (Larinfo::getUptime())getServerInfoto get server info (Larinfo::getServerInfo())getDatabaseInfoto get database info (Larinfo::getDatabaseInfo())
Artisan Command
You also can check using larinfo artisan command, by running this command below.
php artisan larinfo
The example of the result is shown below.
Larinfo
=======
+--------------------+------------------------------------------+
| Application |
+--------------------+------------------------------------------+
| PHP version | 8.1.12 |
| Laravel version | 10.4.1 |
+--------------------+------------------------------------------+
| Database |
+--------------------+------------------------------------------+
| Engine | SQLite |
| Version | 3.40.0 |
+--------------------+------------------------------------------+
| Operating System |
+--------------------+------------------------------------------+
| Type | MacOS |
| Name | MacOS 13.2.1 |
| Architecture | arm64 |
| Kernel Version | 22.3.0 |
+--------------------+------------------------------------------+
| Uptime |
+--------------------+------------------------------------------+
| Uptime | 5 days, 13 hours, 38 minutes, 25 seconds |
| First Boot | 2023-03-19 22:36:46 |
+--------------------+------------------------------------------+
| Server |
+--------------------+------------------------------------------+
| IP Address | 79.224.166.123 |
| Private IP Address | |
| Hostname | p5fe9ab9c.dip0.t-ipconnect.de |
| Provider | AS3320 Deutsche Telekom AG |
| City | Berlin |
| Region | Berlin |
| Country | DE |
+--------------------+------------------------------------------+
| Timezone |
+--------------------+------------------------------------------+
| Application | UTC |
| Server Location | Europe/Berlin |
+--------------------+------------------------------------------+
| Hardware |
+--------------------+------------------------------------------+
| Model | Mac mini |
| CPU count | 8 |
| CPU | Apple M1 |
+--------------------+------------------------------------------+
| RAM |
+--------------------+------------------------------------------+
| Total | 16.0 GiB |
| Free | 54.0 MiB |
+--------------------+------------------------------------------+
| SWAP |
+--------------------+------------------------------------------+
| Total | 3.0 GiB |
| Free | 964.7 MiB |
+--------------------+------------------------------------------+
| Disk Space |
+--------------------+------------------------------------------+
| Total | 2.2 TiB |
| Free | 1.0 TiB |
+--------------------+------------------------------------------+
Running Tests
To run the unit tests, execute this following command.
vendor/bin/phpunit --group unit
GitHub Actions
On the GitHub Actions, the tests run on the respective operating system, which are ubuntu, macos, and windows when a pull request is made.
To run the tests on Ubuntu 20.04 LTS (Focal Fossa) and Ubuntu 22.04 LTS (Jammy Jellyfish), run this following command.
vendor/bin/phpunit --group ubuntu
To run the tests on macOS Monterey (12) and macOS Ventura (13), run this following command.
vendor/bin/phpunit --group macos
To run the tests on Windows Server 2019 and Windows Server 2022, run this following command.
vendor/bin/phpunit --group windows
License
Please see License File for more information.
matriphe/larinfo 适用场景与选型建议
matriphe/larinfo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 42.18k 次下载、GitHub Stars 达 46, 最近一次更新时间为 2017 年 08 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「sysinfo」 「ipinfo」 「larinfo」 「linfo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 matriphe/larinfo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matriphe/larinfo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 matriphe/larinfo 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An IP address information display widget for Yii 2.0 with country flag and geo position info.
A Laravel package that uses geoPlugin web service to fetch information from an IP.
get ipinfo from ipipfreedb and qqwry.
Laravel geolocation with built-in fraud prevention, risk scoring, MFA triggers, IP blocking, threat intelligence, and security auditing. 6 providers (IP2Location.io, MaxMind, IpInfo, IpStack, IpApi, IpGeolocation), proxy/VPN/Tor detection, login tracking, timezone/currency personalization for Larave
Alfabank REST API integration
统计信息
- 总下载量: 42.18k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 46
- 点击次数: 30
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-08-01