PHPackages                             loilo/storage-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. loilo/storage-paths

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

loilo/storage-paths
===================

Get OS-specific paths for storing your project's config, cache, logs etc.

1.0.3(6y ago)1641MITPHPPHP &gt;= 7.1CI failing

Since Jul 15Pushed 5y agoCompare

[ Source](https://github.com/loilo/storage-paths)[ Packagist](https://packagist.org/packages/loilo/storage-paths)[ RSS](/packages/loilo-storage-paths/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (4)Used By (1)

 [![Storage Paths logo: a file cabinet with an open drawer which contains printed document](storage-paths.svg)](storage-paths.svg)

Storage Paths
=============

[](#storage-paths)

[![Tests](https://camo.githubusercontent.com/90d3a173babf78d5147ad2e7bcaaec7a8f18d8de726d73290f334f8bf36bace1/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f6c6f696c6f2f73746f726167652d70617468732f6d6173746572)](https://github.com/loilo/storage-paths/actions)[![Version on packagist.org](https://camo.githubusercontent.com/98c95c7133a29473e89cb689a27cae9e8ada331bea124f627e5ecaa6490fe335/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6c6f696c6f2f73746f726167652d7061746873)](https://packagist.org/packages/loilo/storage-paths)

This package yields OS-specific paths for storing your project's config, cache, logs etc. While the API has been adjusted for PHP, the research and opinionated fallbacks stem from the Node.js [env-paths](https://github.com/sindresorhus/env-paths) package by [Sindre Sorhus](https://github.com/sindresorhus).

Install
-------

[](#install)

```
composer require loilo/storage-paths
```

Usage
-----

[](#usage)

Example for macOS:

```
use Loilo\StoragePaths\StoragePaths;

$paths = StoragePaths::for('MyApp');

$paths->data()   === '/Users/loilo/Library/Application Support/MyApp-php';
$paths->config() === '/Users/loilo/Library/Preferences/MyApp-php';
$paths->cache()  === '/Users/loilo/Library/Caches/MyApp-php';
$paths->log()    === '/Users/loilo/Library/Logs/MyApp-php';
$paths->temp()   === '/var/folders/qh/z_hny67s57sfm_sxy1zynnkr0000gn/T/MyApp-php';
```

API
---

[](#api)

### Signature

[](#signature)

```
StoragePaths::for(string $name, array $options): StoragePathsInterface;
```

- `$name` — The name of your project. This is used to generate the paths, therefore it needs to be a valid filename.
- `$options` — An (optional) associative array of options:

    - `$options['suffix']`

        **Type:** `string`

        **Default:** `'php'`

        A suffix string appended to the project name to avoid naming conflicts with native apps.
    - `$options['os']`

        **Type:** `string`

        **Default:** `PHP_OS_FAMILY`

        Override the operating system to generate paths for. Values correspond to the [`PHP_OS_FAMILY`](https://www.php.net/manual/reserved.constants.php#constant.php-os-family) constant.

> **Note:** Calling `StoragePaths::for()` only generates the path strings. It doesn't create the directories for you.

### Result

[](#result)

The returned [`StoragePathsInterface`](src/StoragePathsInterface.php) provides access to the following storage methods:

- `data()` — Directory for data files
- `config()` — Directory for config files
- `cache()` — Directory for for non-essential data files
- `log()` — Directory for log files
- `temp()` — Directory for temporary files

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~0 days

Total

3

Last Release

2496d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1da49bad9203cc40a34d975dc00c80af09452bee1da6413e2f1b8214b539675?d=identicon)[loilo](/maintainers/loilo)

---

Top Contributors

[![loilo](https://avatars.githubusercontent.com/u/1922624?v=4)](https://github.com/loilo "loilo (14 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/loilo-storage-paths/health.svg)

```
[![Health](https://phpackages.com/badges/loilo-storage-paths/health.svg)](https://phpackages.com/packages/loilo-storage-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)[puli/repository

A filesystem-like repository for storing arbitrary resources.

44287.6k32](/packages/puli-repository)

PHPackages © 2026

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