PHPackages                             gibbs/php-windows-base-dir - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. gibbs/php-windows-base-dir

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gibbs/php-windows-base-dir
==========================

Microsoft Windows base directories and folder paths

2.0.0(1y ago)07MITPHPPHP ^8.3CI passing

Since Nov 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/gibbs/php-windows-base-dir)[ Packagist](https://packagist.org/packages/gibbs/php-windows-base-dir)[ RSS](/packages/gibbs-php-windows-base-dir/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

PHP Windows Base Directory
==========================

[](#php-windows-base-directory)

[![Tests](https://github.com/gibbs/php-windows-base-dir/actions/workflows/test.yml/badge.svg)](https://github.com/gibbs/php-windows-base-dir/actions/workflows/test.yml/badge.svg)

A library to return various Microsoft Windows directory/folder paths based on runtime environment variables.

Install
-------

[](#install)

Install via composer with;

```
composer require gibbs/php-windows-base-dir
```

Usage Examples
--------------

[](#usage-examples)

```
$wbd = new WindowsBaseDir\Wbd;

// Print various paths
echo $wbd->getCommonProgramFilesPath();
echo $wbd->getCommonProgramFilesX86Path();
echo $wbd->getHomeDrivePath();
echo $wbd->getProgramDataPath();
echo $wbd->getProgramFilesPath();
echo $wbd->getSystemDrivePath();
echo $wbd->getSystemRootPath();
echo $wbd->getTempPath();

if ($wbd->isWindowsEnvironment()) {
    $home = $wbd->getHomeDrivePath() . $wbd->getHomePath();
}
else {
    // ...
}
```

Get all available paths:

```
$paths = (new WindowsBaseDir\Wbd)->getAllEnvironmentPaths();
```

```
Array
(
    [ALLUSERSPROFILE] => C:\ProgramData
    [APPDATA] => C:\Users\JoeBloggs\AppData\Roaming
    [COMSPEC] => C:\WINDOWS\system32\cmd.exe
    [COMMONPROGRAMFILES] => C:\Program Files (x86)\Common Files
    [COMMONPROGRAMFILES(X86)] => C:\Program Files (x86)\Common Files
    [DRIVERDATA] => C:\Windows\System32\Drivers\DriverData
    [HOMEDRIVE] => C:
    [HOME] => \Users\JoeBloggs
    [LOCALAPPDATA] => C:\Users\JoeBloggs\AppData\Local
    [LOGONSERVER] => \\DESKTOP-QI5UIAH
    [ONEDRIVE] => C:\Users\JoeBloggs\OneDrive
    [PATH] => C:\Python27\;C:\Python27\Scripts;C:\Windows\system32
    [PROGRAMDATA] => C:\ProgramData
    [PROGRAMFILES] => C:\Program Files (x86)
    [PROGRAMFILES(X86)] => C:\Program Files (x86)
    [PUBLIC] => C:\Users\Public
    [SYSTEMDRIVE] => C:
    [SYSTEMROOT] => C:\WINDOWS
    [TEMP] => C:\Users\JoeBloggs\AppData\Local\Temp
    [USERPROFILE] => C:\Users\JoeBloggs
    [WINDIR] => C:\WINDOWS
)
```

Alternatively use `getAllPaths` for underscore separated and lowercase keys:

```
$paths = (new WindowsBaseDir\Wbd)->getAllPaths();
```

```
Array
(
    [all_users_profile] => C:\ProgramData
    [app_data] => C:\Users\JoeBloggs\AppData\Roaming
    [com_spec] => C:\WINDOWS\system32\cmd.exe
    [common_program_files] => C:\Program Files (x86)\Common Files
    [common_program_files_x86] => C:\Program Files (x86)\Common Files
    [driver_data] => C:\Windows\System32\Drivers\DriverData
    [home_drive] => C:
    [home] => \Users\JoeBloggs
    [local_app_data] => C:\Users\JoeBloggs\AppData\Local
    [logon_server] => \\DESKTOP-QI5UIAH
    [one_drive] => C:\Users\JoeBloggs\OneDrive
    [path] => C:\Python27\;C:\Python27\Scripts;C:\Windows\system32
    [program_data] => C:\ProgramData
    [program_files] => C:\Program Files (x86)
    [program_files_x86] => C:\Program Files (x86)
    [public] => C:\Users\Public
    [system_drive] => C:
    [system_root] => C:\WINDOWS
    [temp] => C:\Users\JoeBloggs\AppData\Local\Temp
    [user_profile] => C:\Users\JoeBloggs
    [win_dir] => C:\WINDOWS
)
```

Testing
-------

[](#testing)

Copy `phpunit.dist.xml` to `phpunit.xml` and run

```
./vendor/bin/phpunit
```

License
-------

[](#license)

MIT License. See [License](https://github.com/gibbs/php-windows-base-dir/blob/master/LICENSE).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance46

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~612 days

Total

3

Last Release

416d ago

Major Versions

1.0.1 → 2.0.02025-03-27

PHP version history (3 changes)1.0.0PHP &gt;=7.1

1.0.1PHP &gt;=7.3

2.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/911b7305e88455fc4fa1958a4d97d3f5a3f6b94a451e98b60f22a1d07f61c8a2?d=identicon)[gibbs](/maintainers/gibbs)

---

Top Contributors

[![gibbs](https://avatars.githubusercontent.com/u/1873895?v=4)](https://github.com/gibbs "gibbs (9 commits)")

---

Tags

phpphp-librarywindows

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gibbs-php-windows-base-dir/health.svg)

```
[![Health](https://phpackages.com/badges/gibbs-php-windows-base-dir/health.svg)](https://phpackages.com/packages/gibbs-php-windows-base-dir)
```

###  Alternatives

[adigital/gdprdatachecker

Run through the database and pull out any information associated with a specified email address

151.0k](/packages/adigital-gdprdatachecker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
