PHPackages                             rockschtar/wordpress-object-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. rockschtar/wordpress-object-storage

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

rockschtar/wordpress-object-storage
===================================

Transients in green

0.1.7(1mo ago)04.0k[1 PRs](https://github.com/rockschtar/wordpress-object-storage/pulls)MITPHPPHP &gt;=8.4CI passing

Since Feb 4Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/rockschtar/wordpress-object-storage)[ Packagist](https://packagist.org/packages/rockschtar/wordpress-object-storage)[ RSS](/packages/rockschtar-wordpress-object-storage/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (10)Versions (16)Used By (0)

rockschtar/wordpress-object-storage
===================================

[](#rockschtarwordpress-object-storage)

[![CI](https://github.com/rockschtar/wordpress-object-storage/actions/workflows/ci.yml/badge.svg)](https://github.com/rockschtar/wordpress-object-storage/actions/workflows/ci.yml)[![Packagist Version](https://camo.githubusercontent.com/f85d091ebd99a15854a0db08b2aad53aab542ae9074a1ca7fe236a9b13deb62a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f636b7363687461722f776f726470726573732d6f626a6563742d73746f72616765)](https://packagist.org/packages/rockschtar/wordpress-object-storage)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md)

Description
-----------

[](#description)

WordPress plugin that provides functions similar to [transients](https://developer.wordpress.org/apis/handbook/transients/) but without their general [behavior](https://core.trac.wordpress.org/ticket/20316#comment:47): transients may disappear at any time (for example when a persistent object cache evicts them), so code must never rely on them. Objects stored with this plugin persist until they expire or are deleted — nothing else removes them.

- Data is stored in the `wp_options` table (never autoloaded), so it survives object cache evictions.
- Optional expiration time per object; expired objects are cleaned up hourly by a WP-Cron job (`rsos_delete_expired`) and lazily on read.
- Values are serialized automatically when needed — store scalars, arrays or objects as they are.

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

[](#requirements)

- PHP &gt;= 8.4
- WordPress &gt;= 6.8

Install
-------

[](#install)

### Composer

[](#composer)

For composer based WordPress projects ([roots/bedrock](https://github.com/roots/bedrock) or [johnpbloch/wordpress](https://github.com/johnpbloch/wordpress)); the package is installed as a must-use plugin (`wordpress-muplugin`):

```
composer require rockschtar/wordpress-object-storage

```

### Manual

[](#manual)

Download `wordpress-object-storage-.zip` from the [latest release](https://github.com/rockschtar/wordpress-object-storage/releases/latest) and install it like any other plugin (the zip ships with its own autoloader).

Usage
-----

[](#usage)

### Set object

[](#set-object)

```
// without expiration time: stored until deleted
rsos_set_object('my-key', 'my-value');

// with expiration time in seconds
rsos_set_object('my-key', 'my-value', DAY_IN_SECONDS);
```

An expiration of `0` (default) means the object never expires. A negative expiration deletes the object.

### Get object

[](#get-object)

```
$value = rsos_get_object('my-key');
```

Returns `false` if the object does not exist or is expired. Like `get_option()`, a stored value of `false` is indistinguishable from a missing object.

### Delete object

[](#delete-object)

```
rsos_delete_object('my-key');
```

### ObjectStorage class

[](#objectstorage-class)

The `rsos_*` functions are thin wrappers around the `ObjectStorage` class, which offers a few more methods:

```
use Rockschtar\WordPress\ObjectStorage\ObjectStorage;

$storage = new ObjectStorage();

$storage->set('my-key', ['foo' => 'bar'], HOUR_IN_SECONDS);
$storage->get('my-key');                // false|mixed
$storage->delete('my-key');             // bool

$storage->expires('my-key');            // expiration as unix timestamp, null if none
$storage->expiresAsDateTime('my-key');  // expiration as DateTime (site timezone), null if none
$storage->getItem('my-key');            // ObjectStorageItem with key, value and expiration

$storage->deleteExpired();              // delete all expired objects (what the cron job runs)
$storage->clear();                      // delete ALL stored objects, expired or not
```

License
-------

[](#license)

rockschtar/wordpress-object-storage is open source and released under MIT license. See [LICENSE.md](LICENSE.md) file for more info.

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance86

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity73

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

Recently: every ~478 days

Total

11

Last Release

31d ago

PHP version history (3 changes)0.0.1-alpha.1PHP &gt;=7.1

0.1.5PHP &gt;=8.3

0.1.7PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/87191?v=4)[Stefan Helmer](/maintainers/rockschtar)[@rockschtar](https://github.com/rockschtar)

---

Top Contributors

[![rockschtar](https://avatars.githubusercontent.com/u/87191?v=4)](https://github.com/rockschtar "rockschtar (22 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/rockschtar-wordpress-object-storage/health.svg)

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

PHPackages © 2026

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