This project has been moved to https://github.com/loophp/phposinfo
drupol / phposinfo Goto Github PK
View Code? Open in Web Editor NEWTry to guess the host operating system.
License: MIT License
Try to guess the host operating system.
License: MIT License
This project has been moved to https://github.com/loophp/phposinfo
A lot of folks (myself included) use this package to assist with telemetry reporting. Having a unique machine identifier for each installation is critical for accurate telemetry.
Similar packages in other ecosystems (such as https://github.com/sebhildebrandt/systeminformation for Node) provide a function to get a machine identifier.
Would you be receptive to adding such a function?
We've been using the following in our applications, I think you could easily add it. Let me know if you want a PR.
/**
* Get a unique ID for the current running environment.
*
* Should conform to UUIDs generated by sebhildebrandt/systeminformation.
*
* @see https://github.com/sebhildebrandt/systeminformation/blob/master/lib/osinfo.js
*
* @return string|null
* The machine UUID.
*/
public static function getMachineUuid() {
switch (OsInfo::family()) {
case FamilyName::LINUX:
return shell_exec('( cat /var/lib/dbus/machine-id /etc/machine-id 2> /dev/null || hostname ) | head -n 1 || :');
case FamilyName::DARWIN:
$output = shell_exec('ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID');
$parts = explode('=', str_replace('"', '', $output));
return strtolower(trim($parts[1]));
case FamilyName::WINDOWS:
return shell_exec('%windir%\\System32\\reg query "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography" /v MachineGuid');
default:
return NULL;
}
}
Hi!
Would that make sense to add arch information? I'm planning to use binaries and arch seems to be something that matters.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.