PHPackages                             varunsridharan/wp-transient-api - 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. [Caching](/categories/caching)
4. /
5. varunsridharan/wp-transient-api

ActiveLibrary[Caching](/categories/caching)

varunsridharan/wp-transient-api
===============================

Provides Option to store Transient / options with version management.

1.8(5y ago)24221[1 PRs](https://github.com/varunsridharan/wp-transient-api/pulls)1GPL-3.0-or-laterPHP

Since Dec 17Pushed 5y ago1 watchersCompare

[ Source](https://github.com/varunsridharan/wp-transient-api)[ Packagist](https://packagist.org/packages/varunsridharan/wp-transient-api)[ Fund](https://paypal.me/varunsridharan23)[ Fund](https://www.buymeacoffee.com/varunsridharan)[ RSS](/packages/varunsridharan-wp-transient-api/feed)WikiDiscussions main Synced 2mo ago

READMEChangelog (10)DependenciesVersions (12)Used By (1)

WordPress Transient API
=======================

[](#wordpress-transient-api)

This library provides developers to manage all their Transients with version management.

[![Latest Stable Version](https://camo.githubusercontent.com/419c9e32a853bf26be5aa2cbb550658108dedd7d3f3d0176150eee2f5632a931/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f77702d7472616e7369656e742d6170692f76657273696f6e)](https://packagist.org/packages/varunsridharan/wp-transient-api)[![Total Downloads](https://camo.githubusercontent.com/5852bacc203e98dd7071999958b27a0ff279c637b495a182a54a2834d65d3a1e/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f77702d7472616e7369656e742d6170692f646f776e6c6f616473)](https://packagist.org/packages/varunsridharan/wp-transient-api)[![Latest Unstable Version](https://camo.githubusercontent.com/de26c1e11cff90856eec406e91765fdb9878760ed5e4bf0719092e4c9b920eb7/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f77702d7472616e7369656e742d6170692f762f756e737461626c65)](//packagist.org/packages/varunsridharan/wp-transient-api)[![License](https://camo.githubusercontent.com/717c21b67e8e5047d920ddcf793a2c95c74164992c76db36d1712e690769c333/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f77702d7472616e7369656e742d6170692f6c6963656e7365)](https://packagist.org/packages/varunsridharan/wp-transient-api)[![composer.lock available](https://camo.githubusercontent.com/39b36ac0f019d60845d05aa6b4e0c9cda250e0c335758cf864a83b4da3b077a8/68747470733a2f2f706f7365722e707567782e6f72672f766172756e73726964686172616e2f77702d7472616e7369656e742d6170692f636f6d706f7365726c6f636b)](https://packagist.org/packages/varunsridharan/wp-transient-api)

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

[](#installation)

The preferred way to install this extension is through [Composer](http://getcomposer.org/download/).

To install **WP\_Transient\_API library**, simply:

```
$ composer require Varunsridharan/WP_Transient_API

```

The previous command will only install the necessary files, if you prefer to **download the entire source code** you can use:

```
$ composer require Varunsridharan/WP_Transient_API --prefer-source

```

You can also **clone the complete repository** with Git:

```
$ git clone https://github.com/varunsridharan/wp-transient-api.git

```

Or **install it manually**:

[Download WP\_Transient\_API.php](https://raw.githubusercontent.com/varunsridharan/wp-transient-api/master/class-transient-wp-api.php):

```
$ wget https://raw.githubusercontent.com/varunsridharan/wp-transient-api/master/class-transient-wp-api.php

```

Options
-------

[](#options)

OptionNotes***WP Options API***`option_prefix`Custom text to auto prefix for each option added via this class`option_surfix`Custom text to auto append for each option added via this class`option_version`On Which version the given option to be saved`option_auto_delete`if set to true then it auto deletes if the version dose not match***WP Transient API***`transient_prefix`Custom text to auto prefix for each option added via this class`transient_surfix`Custom text to auto append for each option added via this class`transient_version`On Which version the given option to be saved`transient_auto_delete`if set to true then it auto deletes if the version dose not matchUsage
-----

[](#usage)

```
$api = new Varunsridharan\WordPress\Transient_API::instance('instance_key',array(
    // Transients
    'transient_version'     => 1.0,
    'transient_auto_delete' => false,
    'transient_surfix'      => '',
    'transient_prefix'      => '',
    // WP DB Options
    'option_auto_delete'    => false,
    'option_version'        => 1.0,
    'option_surfix'         => '',
    'option_prefix'         => '',
    // Global Config.
    'is_option'             => false,
));
YourPlugin_Transient_Api::instance();
```

Global Based On Class Settings
------------------------------

[](#global-based-on-class-settings)

**Note** : `update only works for if class set to wp options api`

```
YourPlugin_Transient_Api::instance('instance_key')->set('your-key','your-value');
YourPlugin_Transient_Api::instance('instance_key')->get('your-key'); # Returns the values only if option version matched with $option_version
YourPlugin_Transient_Api::instance('instance_key')->update('your-key','your-value'); # Updates the options value
YourPlugin_Transient_Api::instance('instance_key')->delete('your-key'); # Deletes the options and its releated options
```

WP Options API With Version Management
--------------------------------------

[](#wp-options-api-with-version-management)

```
YourPlugin_Transient_Api::instance('instance_key')->add_option('your-key','your-value');
YourPlugin_Transient_Api::instance('instance_key')->get_option('your-key'); # Returns the values only if option version matched with $option_version
YourPlugin_Transient_Api::instance('instance_key')->update_option('your-key','your-value'); # Updates the options value
YourPlugin_Transient_Api::instance('instance_key')->delete_option('your-key'); # Deletes the options and its releated options
```

WP Transient API With Version Management
----------------------------------------

[](#wp-transient-api-with-version-management)

```
YourPlugin_Transient_Api::instance('instance_key')->add_transient('your-key','your-value',2000);
YourPlugin_Transient_Api::instance('instance_key')->get_transient('your-key'); # Returns the values only if option version matched with $transient_version
YourPlugin_Transient_Api::instance('instance_key')->delete_transient('your-key'); # Deletes the options and its releated options
```

---

📝 Changelog
-----------

[](#-changelog)

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[Checkout CHANGELOG.md](https://github.com/varunsridharan/wp-transient-api/blob/main/CHANGELOG.md)

🤝 Contributing
--------------

[](#-contributing)

If you would like to help, please take a look at the list of [issues](https://github.com/varunsridharan/wp-transient-api/issues/).

📜 License &amp; Conduct
-----------------------

[](#--license--conduct)

- [**GNU General Public License v3.0**](https://github.com/varunsridharan/wp-transient-api/blob/main/LICENSE) © [Varun Sridharan](website)
- [Code of Conduct](https://github.com/varunsridharan/.github/blob/main/CODE_OF_CONDUCT.md)

📣 Feedback
----------

[](#-feedback)

- ⭐ This repository if this project helped you! 😉
- Create An [🔧 Issue](https://github.com/varunsridharan/wp-transient-api/issues/) if you need help / found a bug

💰 Sponsor
---------

[](#-sponsor)

[I](https://sva.onl/twitter/) fell in love with open-source in 2013 and there has been no looking back since! You can read more about me [here](https://sva.onl/website/). If you, or your company, use any of my projects or like what I’m doing, kindly consider backing me. I'm in this for the long run.

- ☕ How about we get to know each other over coffee? Buy me a cup for just [**$9.99**](https://sva.onl/buymeacoffee)
- ☕️☕️ How about buying me just 2 cups of coffee each month? You can do that for as little as [**$9.99**](https://sva.onl/buymeacoffee)
- 🔰 We love bettering open-source projects. Support 1-hour of open-source maintenance for [**$24.99 one-time?**](https://sva.onl/paypal)
- 🚀 Love open-source tools? Me too! How about supporting one hour of open-source development for just [**$49.99 one-time ?**](https://sva.onl/paypal)

Connect &amp; Say 👋
-------------------

[](#connect--say-)

- **Follow** me on [👨‍💻 Github](https://sva.onl/github/) and stay updated on free and open-source software
- **Follow** me on [🐦 Twitter](https://sva.onl/twitter/) to get updates on my latest open source projects
- **Message** me on [📠 Telegram](https://sva.onl/telegram/)
- **Follow** my pet on [Instagram](https://www.instagram.com/sofythelabrador/) for some *dog-tastic* updates!

---

*Built With ♥ By [Varun Sridharan](https://sva.onl/twitter) [ ![](https://camo.githubusercontent.com/ac180da7a81f72a639abce09c4827e7bacfdd3b82586b657387a7f84430c7b7f/68747470733a2f2f63646e2e73766172756e2e6465762f666c61672d696e6469612e6a7067)](https://en.wikipedia.org/wiki/India)*

 [![](https://camo.githubusercontent.com/51991d58f40dac784a0c08b9c5c16c66c59ef5bdf083e3d49e4f617ef98e03ee/68747470733a2f2f63646e2e73766172756e2e6465762f636f64656973706f657472792e706e67)](https://camo.githubusercontent.com/51991d58f40dac784a0c08b9c5c16c66c59ef5bdf083e3d49e4f617ef98e03ee/68747470733a2f2f63646e2e73766172756e2e6465762f636f64656973706f657472792e706e67)

---

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

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

Recently: every ~176 days

Total

10

Last Release

1854d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/522dc9d037e4b0517ee9b76cd63d75a6331b0e578afa9b27fee84b02863ace80?d=identicon)[varunsridharan](/maintainers/varunsridharan)

---

Top Contributors

[![varunsridharan](https://avatars.githubusercontent.com/u/1884287?v=4)](https://github.com/varunsridharan "varunsridharan (28 commits)")

---

Tags

transient-handlertransientsvsp-libswordpresswordpress-cachewordpress-datawordpress-developmentwordpress-librarywordpress-php-librarywordpress-pluginwordpress-plugin-developmentwordpress-plugin-librarywordpress-pluginswordpress-themewordpress-transientswp-librarywp-pluginwp-themewordpresswordpress pluginwordpress-themetransientswordpress-libraryWP Pluginwordpress-developmentwordpress-transientswordpress-pluginswp themewordpress plugin developmentwordpress-cachewordpress-plugin-librarywordpress-php-libraryvsp-libswp-librarytransient-handlerwordpress-data

### Embed Badge

![Health badge](/badges/varunsridharan-wp-transient-api/health.svg)

```
[![Health](https://phpackages.com/badges/varunsridharan-wp-transient-api/health.svg)](https://phpackages.com/packages/varunsridharan-wp-transient-api)
```

###  Alternatives

[varunsridharan/wp-dependencies

Provides Function To Check if a plugin is active/inactive &amp; function to compare versions.

1032.5k1](/packages/varunsridharan-wp-dependencies)[stevegrunwell/wp-cache-remember

Helper for the WordPress object cache and transients

14891.2k](/packages/stevegrunwell-wp-cache-remember)[leocolomb/wp-redis

A persistent cache backend for WordPress powered by Redis.

197.2k](/packages/leocolomb-wp-redis)[justcoded/wordpress-theme-boilerplate

WordPress theme boilerplate with better code structure and OOP support.

563.9k1](/packages/justcoded-wordpress-theme-boilerplate)[renakdup/simple-dic

Simple DI Container with autowiring for your WordPress application with NO dependencies.

101.8k1](/packages/renakdup-simple-dic)

PHPackages © 2026

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