A small PHP library for accessing Windows directory paths.

  1. Example Usage
  2. Installation
  3. API

Source available on GitHub

Installation

Install the package with Composer:

composer require gibbs/php-windows-base-dir

Example Usage

Using the Composer autoloader, print all available paths:

// Path to the Composer autoloader
require __DIR__ . '/vendor/autoload.php';

// Get all paths
$paths = (new WindowsBaseDir\Wbd)->getAllEnvironmentPaths();

// Print
print_r($paths);

API

VisibilityFunction
publicgetAllEnvironmentPaths() : array
An array of all paths with the envvar as key
publicgetAllPaths() : array
An array of all paths with underscore delimited key names
publicgetAllUsersProfilePath() : string/null
publicgetAppDataPath() : string/null
publicgetComSpecPath() : string/null
publicgetCommonProgramFilesPath() : string/null
publicgetCommonProgramFilesX86Path() : string/null
publicgetDriverDataPath() : string/null
publicgetEnvironment() : string/null
publicgetHomeDrive() : string/null
publicgetHomeDrivePath() : string/null
publicgetHomePath() : string/null
publicgetLocalAppDataPath() : string/null
publicgetLogonServerPath() : string/null
publicgetOneDrivePath() : string/null
publicgetPath() : string/null
publicgetPathExt() : string/null
publicgetProgramDataPath() : string/null
publicgetProgramFilesPath() : string/null
publicgetProgramFilesX86Path() : string/null
publicgetPublicPath() : string/null
publicgetSystemDrivePath() : string/null
publicgetSystemRootPath() : string/null
publicgetTempPath() : string/null
publicgetUserDomain() : string/null
publicgetUserDomainRoaminProfile() : string/null
publicgetUserProfilePath() : string/null
publicgetUsername() : string/null
publicgetWindirPath() : string/null
publicisWindowsEnvironment() : bool
Determine if the current runtime environment is Windows