Coder Social home page Coder Social logo

phposinfo's Introduction

phposinfo's People

Contributors

danepowell avatar drupol avatar ganofins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

phposinfo's Issues

Get the OS / current machine UUID

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;
    }
  }

Add architecture

Hi!

Would that make sense to add arch information? I'm planning to use binaries and arch seems to be something that matters.

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.