Skip to content

🖥️ GetSystemInfo ​

Collects and returns information about the current system environment for diagnosing installation issues.

When to Use ​

Use this when installation fails and you need to investigate environment dependencies (whether PHP, package manager, Homebrew, and curl are ready). 📊

Signature ​

go
func GetSystemInfo() map[string]string

Parameters ​

ParameterTypeDescription
None—Package-level function, takes no parameters

Return Value ​

  • map[string]string: Key-value pairs of system information. ✅

Possible keys include: php_available, php_version, composer_available, composer_path, composer_version, distro_id, distro_name, distro_version, package_manager, brew_available, curl_available.

Example ​

go
package main

import (
	"fmt"

	"github.com/scagogogo/composer-skills/pkg/installer"
)

func main() {
	info := installer.GetSystemInfo()
	for k, v := range info {
		fmt.Printf("%s = %s\n", k, v)
	}
}

Advanced ​

  • This method aggregates multiple detection capabilities including HasPHP, GetPHPVersion, IsComposerInstalled, and DetectLinuxDistro. 🔗
  • On non-Linux systems, distro-related fields will be missing; brew_available is mainly meaningful on macOS. 🐧
  • Well suited for inclusion in bug reports or install logs. 📝

Released under the MIT License