PHPackages                             bgreenacre/env-paths - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. bgreenacre/env-paths

ActiveLibrary[File &amp; Storage](/categories/file-storage)

bgreenacre/env-paths
====================

Provides paths for where to store things like cache, configs, data etc. given the environment and user that is running the application.

00PHP

Since Apr 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/bgreenacre/env-paths)[ Packagist](https://packagist.org/packages/bgreenacre/env-paths)[ RSS](/packages/bgreenacre-env-paths/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Env Paths
=========

[](#env-paths)

[![Latest Version](https://camo.githubusercontent.com/2c7f39e3306cc40a77e6dc29dd67d0d1b6c9f734595761f9ae0664488f0e0998/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62677265656e616372652f656e762d70617468732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bgreenacre/env-paths)[![Total Downloads](https://camo.githubusercontent.com/1e50afa9206c8cae4c117cd4557900a1615e2a844f0ba4c3f52ad373e3293e99/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62677265656e616372652f656e762d70617468732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bgreenacre/env-paths)[![Software License](https://camo.githubusercontent.com/c2bffd81d308ced1cc3b0d66fb0ed453ab478a5e17c988b780f9de986a390ee2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/16511301774469ce8b61bb2ab98c716ef1b244a31852d29a86a54ab7bc8d7f5f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f62677265656e616372652f656e762d70617468732f54657374732f6d61696e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/bgreenacre/env-paths/actions?query=workflow%3ATests+branch%3Amain)

Provides paths for where to store things like cache, configs, data etc. given the environment and user that is running the application. Heavily inspired by the [envPaths nodejs package](https://github.com/sindresorhus/env-paths) and composer's way finding home folder of the user.

Requirements
------------

[](#requirements)

- PHP (7.2+)

Usage
-----

[](#usage)

Example

```
$paths = Bgreenacre\EnvPaths\EnvPaths::getPaths('MyApp');

/**
 *  - macOS: `~/Library/Application Support/MyApp-php`
 *  - Windows: `%LOCALAPPDATA%\MyApp-php\Data` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-php\Data`)
 *  - Linux: `~/.local/share/MyApp-php` (or `$XDG_DATA_HOME/MyApp-php`)
 */
echo $paths['data'];

/**
 * - macOS: `~/Library/Caches/MyApp-php`
 * - Windows: `%LOCALAPPDATA%\MyApp-php\Cache` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-php\Cache`)
 * - Linux: `~/.cache/MyApp-php` (or `$XDG_CACHE_HOME/MyApp-php`)
 */
echo $paths['cache'];

/**
 *  - macOS: `~/Library/Preferences/MyApp-php`
 *  - Windows: `%APPDATA%\MyApp-php\Config` (for example, `C:\Users\USERNAME\AppData\Roaming\MyApp-php\Config`)
 *  - Linux: `~/.config/MyApp-php` (or `$XDG_CONFIG_HOME/MyApp-php`)
 */
echo $paths['config'];

/**
 *  - macOS: `~/Library/Logs/MyApp-php`
 *  - Windows: `%LOCALAPPDATA%\MyApp-php\Log` (for example, `C:\Users\USERNAME\AppData\Local\MyApp-php\Log`)
 *  - Linux: `~/.local/state/MyApp-php` (or `$XDG_STATE_HOME/MyApp-php`)
 */
echo $paths['log'];

/**
 *  - macOS: `/var/folders/jf/f2twvvvs5jl_m49tf034ffpw0000gn/T/MyApp-php`
 *  - Windows: `%LOCALAPPDATA%\Temp\MyApp-php` (for example, `C:\Users\USERNAME\AppData\Local\Temp\MyApp-php`)
 *  - Linux: `/tmp/USERNAME/MyApp-php`
 */
echo $paths['temp'];
```

License
-------

[](#license)

This library is licensed under the MIT License - see the LICENSE file for details.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e80819b05f7cb5a41410fd8c6bf4733a2b2ca5d50975d3f24e3e63f8611633f?d=identicon)[bgreenacre](/maintainers/bgreenacre)

---

Top Contributors

[![bgreenacre](https://avatars.githubusercontent.com/u/167656?v=4)](https://github.com/bgreenacre "bgreenacre (32 commits)")

### Embed Badge

![Health badge](/badges/bgreenacre-env-paths/health.svg)

```
[![Health](https://phpackages.com/badges/bgreenacre-env-paths/health.svg)](https://phpackages.com/packages/bgreenacre-env-paths)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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