PHPackages                             gilbitron/hoard - 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. gilbitron/hoard

ActiveLibrary[Caching](/categories/caching)

gilbitron/hoard
===============

PHP caching done right

0.1.1(11y ago)3125MITPHPPHP &gt;=5.4.0

Since Jan 7Pushed 11y ago1 watchersCompare

[ Source](https://github.com/gilbitron/Hoard)[ Packagist](https://packagist.org/packages/gilbitron/hoard)[ Docs](https://github.com/gilbitron/Hoard)[ RSS](/packages/gilbitron-hoard/feed)WikiDiscussions master Synced 1mo ago

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

Hoard
=====

[](#hoard)

[![Build Status](https://camo.githubusercontent.com/ceb7dfea287d5c2244156736aaaaa97f73560489d9095f9643482fdbd0161779/68747470733a2f2f7472617669732d63692e6f72672f67696c626974726f6e2f486f6172642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gilbitron/Hoard)

Hoard is a simple, extensible PHP caching library.

Install
-------

[](#install)

Install via [composer](https://getcomposer.org):

```
{
    "require": {
        "gilbitron/hoard": "~0.1.0"
    }
}
```

Run `composer install` then use as normal:

```
require 'vendor/autoload.php';
$cache = new Hoard\Hoard();
```

API
---

[](#api)

Hoard uses the conecpt of "drawers" (as in a chest of drawers) as drivers for caching.

```
$cache = new Hoard\Hoard($drawer = 'file', $options = [], $args = []);
```

Possible drawers (more to come):

- `file`

`$options` is an array of options passed to the chosen drawer. See [Drawers](#drawers) section below.

`$args`:

- `encrypt_keys` - Use encrypted keys (default: `true`)
- `encryption_function` - Function to use for encrypting keys `md5`/`sha1` (default: `md5`)

---

Determine if an item exists in the cache

```
$cache->has($key);
```

---

Retrieve an item from the cache by key

```
$cache->get($key, $default = null);
```

---

Retrieve an item from the cache and delete it

```
$cache->pull($key, $default = null);
```

---

Store an item in the cache. `$minutes` can be an int or DateTime

```
$cache->put($key, $value, $minutes);
```

---

Store an item in the cache if the key does not exist. `$minutes` can be an int or DateTime

```
$cache->add($key, $value, $minutes);
```

---

Store an item in the cache indefinitely

```
$cache->forever($key, $value);
```

---

Remove an item from the cache

```
$cache->forget($key);
```

---

Remove all items from the cache

```
$cache->flush();
```

Drawers
-------

[](#drawers)

#### `file`

[](#file)

Basic FileSystem caching.

Options:

- `cache_dir` - Path to cache directory. Uses the system tmp dir if none provided.

Credits
-------

[](#credits)

Hoard was created by [Gilbert Pellegrom](http://gilbert.pellegrom.me) from [Dev7studios](http://dev7studios.com). Released under the MIT license.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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

2

Last Release

4147d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.0

0.1.1PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/20011de485eeea26b5582c75daaab217937832762b5d5f551d34d07f74138bb0?d=identicon)[gilbitron](/maintainers/gilbitron)

---

Top Contributors

[![gilbitron](https://avatars.githubusercontent.com/u/203882?v=4)](https://github.com/gilbitron "gilbitron (12 commits)")

---

Tags

cachecaching

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gilbitron-hoard/health.svg)

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

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

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

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[spatie/blink

Cache that expires in the blink of an eye

1685.0M8](/packages/spatie-blink)[gregwar/cache

A lightweight file-system cache system

1084.5M22](/packages/gregwar-cache)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

153471.5k29](/packages/putyourlightson-craft-blitz)

PHPackages © 2026

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