PHPackages                             wendelladriel/cache-ttl-helper - 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. wendelladriel/cache-ttl-helper

ActiveLibrary[Caching](/categories/caching)

wendelladriel/cache-ttl-helper
==============================

Helper Enum for handling cache TTLs in a simple, easy and friendly way

v1.0.0(2y ago)2212.2k↓39.8%MITPHPPHP ^8.1

Since Aug 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/WendellAdriel/cache-ttl-helper)[ Packagist](https://packagist.org/packages/wendelladriel/cache-ttl-helper)[ Fund](https://www.paypal.me/wendelladriel)[ GitHub Sponsors](https://github.com/WendellAdriel)[ RSS](/packages/wendelladriel-cache-ttl-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Cache TTL Helper
================

[](#cache-ttl-helper)

 Helper Enum for handling cache TTLs in a simple, easy and friendly way

[![Packagist](https://camo.githubusercontent.com/b2e9d1bc9e2697f21e19f7e6a638a443f11c03999c98872ea779fce3bde35970/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f57656e64656c6c41647269656c2f63616368652d74746c2d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/WendellAdriel/cache-ttl-helper)[![PHP from Packagist](https://camo.githubusercontent.com/6128be069f136bf3fb3b1665e98c87049a6f30f778b94c97184aace13caddd2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f57656e64656c6c41647269656c2f63616368652d74746c2d68656c7065722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/WendellAdriel/cache-ttl-helper)[![GitHub Workflow Status (main)](https://camo.githubusercontent.com/9f561728c6cf026b5e217689fac55ea82fb9dac35069a07e66ba156862da6952/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f57656e64656c6c41647269656c2f63616368652d74746c2d68656c7065722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d5465737473) ](https://github.com/WendellAdriel/cache-ttl-helper/actions)

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

[](#installation)

```
composer require wendelladriel/cache-ttl-helper
```

Usage
-----

[](#usage)

This package provides a simple Enum class with some helper methods to handle cache TTLs in a simple, easy and friendly way.

All methods are static, and they all return the TTL in seconds.

### Methods available

[](#methods-available)

```
use WendellAdriel\CacheTtlHelper\CacheTTL;

CacheTTL::second(); // 1s
CacheTTL::seconds(30); // 30s

CacheTTL::minute(); // 60s
CacheTTL::minutes(5); // 300s

CacheTTL::hour(); // 3600s
CacheTTL::hours(2); // 7200s

CacheTTL::day(); // 86400s
CacheTTL::days(3); // 259200s

CacheTTL::week(); // 604800s
CacheTTL::weeks(2); // 1209600s

CacheTTL::month(); // 2592000s
CacheTTL::months(6); // 15552000s

CacheTTL::year(); // 31536000s
CacheTTL::years(2); // 63072000s
```

Credits
-------

[](#credits)

- [Wendell Adriel](https://github.com/WendellAdriel)
- [All Contributors](../../contributors)

Contributing
------------

[](#contributing)

Check the **[Contributing Guide](CONTRIBUTING.md)**.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

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

Unknown

Total

1

Last Release

1005d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/565cea386dcfc4df5188a338113624866e65e4b31b209a7a99bb6c4c272e8731?d=identicon)[wendell\_adriel](/maintainers/wendell_adriel)

---

Top Contributors

[![WendellAdriel](https://avatars.githubusercontent.com/u/11641518?v=4)](https://github.com/WendellAdriel "WendellAdriel (3 commits)")

---

Tags

cacheenumttlttl-cachehelperenumcachettl

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/wendelladriel-cache-ttl-helper/health.svg)

```
[![Health](https://phpackages.com/badges/wendelladriel-cache-ttl-helper/health.svg)](https://phpackages.com/packages/wendelladriel-cache-ttl-helper)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[psr/cache

Common interface for caching libraries

5.2k686.9M1.3k](/packages/psr-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[beste/in-memory-cache

A PSR-6 In-Memory cache that can be used as a fallback implementation and/or in tests.

2512.2M6](/packages/beste-in-memory-cache)[rtcamp/nginx-helper

Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also provides cloudflare edge cache purging with Cache-Tags.

23517.0k1](/packages/rtcamp-nginx-helper)

PHPackages © 2026

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