stougeiro/cache-contract

Minimal cache contract package defining the essential interfaces for a plug-and-play caching layer. Provides a lightweight CacheInterface with basic operations for storing, retrieving, checking, deleting and clearing cached values in modular PHP applications.

Maintainers

Package info

github.com/stougeiro/cache-contract

pkg:composer/stougeiro/cache-contract

Transparency log

Fund package maintenance!

Buymeacoffee

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-19 17:55 UTC

This package is auto-updated.

Last update: 2026-08-19 18:30:57 UTC


README

phpstan-level

Cache Contract

A minimal cache contract that defines only the essential operations for any temporary storage mechanism. It provides a simple, predictable, and pluggable interface so that different implementations can be used interchangeably in modular PHP applications.

✨ Features

  • Minimal and predictable API
    A single CacheInterface defining the core operations: has, get, set, delete e clear.

  • Plug-and-play design
    Any cache implementation can be swapped without changing application logic.

  • Framework-agnostic
    Works with any architecture, from micro-frameworks to full-stack applications.

  • Lightweight by design
    No dependencies, no assumptions — just the essential contract.

📦 Installation

Install via Composer:

composer require stougeiro/cache-contract

🔧 Implementations

Below is a list of known implementations maintained by the community.

🧠 Why?

Because caching should be simple. This package defines the smallest possible contract for a cache layer, allowing developers to implement their own storage strategies — file-based, memory-based, database-backed, distributed, or custom — while keeping a consistent interface across the entire application.

It allows any cache engine to be replaced without impacting the application code, promoting modularity, testability, and flexibility.

🤝 Contributions

Contributions are welcome. Feel free to open issues or submit pull requests.