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

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

solophp/storage
===============

Simple file-based storage system for storing string data using key-value pairs.

v1.2.0(9mo ago)092MITPHPPHP &gt;=8.1

Since Jul 13Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/SoloPHP/Storage)[ Packagist](https://packagist.org/packages/solophp/storage)[ RSS](/packages/solophp-storage/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Solo Storage
============

[](#solo-storage)

[![Latest Version on Packagist](https://camo.githubusercontent.com/25c6f1f39b361b672c93effc964092461d1a81bfb729e01a45612c623166f9ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6c6f7068702f73746f726167652e737667)](https://packagist.org/packages/solophp/storage)[![License](https://camo.githubusercontent.com/a4bf88498b935eeb4d8ffac000245c6238777366744c891936cc2fd4eac77d87/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736f6c6f7068702f73746f726167652e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/d20c673e2522473a5c3a53321b3d57e0d857359f15bd2565b56ec108d9a46f56/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736f6c6f7068702f73746f726167652e737667)](https://packagist.org/packages/solophp/storage)

A lightweight, file-based storage system for PHP applications that provides simple key-value pair storage functionality.

Features
--------

[](#features)

- Simple key-value storage interface
- File-based persistence
- Thread-safe file operations
- Directory traversal protection
- Minimal dependencies
- Type-safe implementation (strict types)

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

[](#requirements)

- PHP 8.1 or higher

Installation
------------

[](#installation)

```
composer require solophp/storage
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

```
use Solo\Storage;

// Initialize with default storage location (current directory)
$storage = new Storage();

// Or specify a custom storage directory
$storage = new Storage('/path/to/storage/directory');
```

### Store Data

[](#store-data)

```
// Store a string value
$storage->set('user.name', 'John Doe');
$storage->set('user.email', 'john@example.com');
```

### Retrieve Data

[](#retrieve-data)

```
// Get a stored value
$name = $storage->get('user.name'); // Returns 'John Doe'

// Handle non-existent keys
$value = $storage->get('non.existent.key'); // Returns null
```

### Check Data Existence

[](#check-data-existence)

```
// Check if a key exists
if ($storage->has('user.name')) {
    // Key exists
}
```

### Delete Data

[](#delete-data)

```
// Delete a stored value
$storage->delete('user.name');
```

Error Handling
--------------

[](#error-handling)

All methods are designed to fail gracefully:

- `set()` returns `bool` indicating success/failure
- `get()` returns `null` if key doesn't exist or on error
- `has()` returns `bool` indicating key existence
- `delete()` returns `bool` indicating success/failure

Security
--------

[](#security)

The storage system includes protection against directory traversal attacks by sanitizing storage keys.

Thread Safety
-------------

[](#thread-safety)

File operations use exclusive locks (`LOCK_EX`) to ensure thread safety when writing data.

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance56

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

4

Last Release

288d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.4

v1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f29817cec408d033cd4441c8f760e3ae40248dc0f66856a09080d282aee6959?d=identicon)[Vitaliy Olos](/maintainers/Vitaliy%20Olos)

---

Top Contributors

[![SoloPHP](https://avatars.githubusercontent.com/u/175482616?v=4)](https://github.com/SoloPHP "SoloPHP (8 commits)")

---

Tags

phpstorageKey valuefile storagedata-storagesimple storage

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/solophp-storage/health.svg)](https://phpackages.com/packages/solophp-storage)
```

PHPackages © 2026

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