patelworld/systeminfo

用于获取系统相关信息,例如RAM、磁盘、驱动器、主板等。

v1.0.0 2024-05-27 04:28 UTC

This package is auto-updated.

Last update: 2024-09-28 03:23:17 UTC


README

System Info是一个PHP库,根据WMIC命令提供系统相关信息。

License: MIT

目录

安装

composer require patelworld/systeminfo

基本用法

命名空间

系统信息库位于PatelWorld\SystemInfo命名空间下。

安装好系统信息库后,获取系统信息非常简单。

首先,如果你在一个框架中工作,那么创建一个所需类型的实例,并在php文件顶部使用use语句导入相关类。以下是一个示例。类可用作静态使用。

接下来,只需在类上静态调用方法名。ClassName::methodName()

示例

use PatelWorld\SystemInfo\DiskDrive;

echo DiskDrive::diskCount(); //2
print_r(DiskDrive::getSerialNumber()); // Array
Array
(
    [0] => KINGSTON XAB400S374580X
    [1] => SW1000MP010-2WPX305
)

类和方法

电池

use PatelWorld\SystemInfo\Battery;

print_r(Battery::details());
print_r(Battery::getSize());
print_r(Battery::getPartNumber());
print_r(Battery::getAttributes(["Name","Description"]));

主板

use PatelWorld\SystemInfo\Board;

print_r(Board::details());
print_r(Board::getModel());
print_r(Board::getSerialNumber());
print_r(Board::getManufacturer());
print_r(Board::getAttributes(["Name","Description"]));

处理器

use PatelWorld\SystemInfo\Cpu;

print_r(Cpu::details());
print_r(Cpu::getModel());
print_r(Cpu::getManufacturer());
print_r(Cpu::getAttributes(["Name","Description"]));

磁盘驱动器

use PatelWorld\SystemInfo\DiskDrive;

print_r(DiskDrive::diskCount());
print_r(DiskDrive::details());
print_r(DiskDrive::getModel());
print_r(DiskDrive::getSerialNumber());
print_r(DiskDrive::getSize());
print_r(DiskDrive::getPartitionsCount());
print_r(DiskDrive::getManufacturer());
print_r(DiskDrive::getDiskDetails());
print_r(DiskDrive::getWindowsDiskDetails());
print_r(DiskDrive::getAttributes(["Name","Description"]));

显卡

use PatelWorld\SystemInfo\GraophicsCard;

print_r(GraophicsCard::details());
print_r(GraophicsCard::getModel());
print_r(GraophicsCard::getManufacturer());
print_r(GraophicsCard::getAttributes(["Name","Description"]));

逻辑驱动器

use PatelWorld\SystemInfo\LocicalDrive;

print_r(LocicalDrive::details());
print_r(LocicalDrive::getAttributes(["Name","Description"]));

内存芯片(RAM)

use PatelWorld\SystemInfo\MemoryChip;

print_r(MemoryChip::details());
print_r(MemoryChip::getSize());
print_r(MemoryChip::getPartNumber());
print_r(MemoryChip::getAttributes(["Name","Description"]));

网络适配器

use PatelWorld\SystemInfo\NetworkAdapter;

print_r(NetworkAdapter::details());
print_r(NetworkAdapter::getAttributes(["Name","Description"]));

操作系统

use PatelWorld\SystemInfo\Os;

print_r(Os::details());
print_r(Os::getBuildNumber());
print_r(Os::getManufacturer());
print_r(Os::getSerialNumber());
print_r(Os::getSystemDrive());
print_r(Os::getAttributes(["Name","Description"]));

声音设备

use PatelWorld\SystemInfo\SoundDevice;

print_r(SoundDevice::details());
print_r(SoundDevice::getProductName());
print_r(SoundDevice::getManufacturer());
print_r(SoundDevice::getStatus());
print_r(SoundDevice::getAttributes(["Name","Description"]));

USB

use PatelWorld\SystemInfo\Usb;

print_r(Usb::details());
print_r(Usb::getName());
print_r(Usb::getManufacturer());
print_r(Usb::getAttributes(["Name","Description"]));