Download the PHP package php-pico/caching without Composer

On this page you can find all versions of the php package php-pico/caching. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package caching

php-pico/caching

A dependency-light PSR-16 (psr/simple-cache) and PSR-6 (psr/cache) cache for PHP 8.5+.

Two facades — the PSR-16 Cache and the PSR-6 CachePool — sit over the same swappable drivers. The facades own key validation, value (de)serialization and TTL handling; each driver only stores and retrieves the resulting string payloads. This keeps drivers thin, interchangeable, and independently testable, and lets both standards share one backend.

Installation

PSR-16 (simple cache)

Construct a Cache with the driver of your choice and use it through the standard PSR-16 API:

get()/set()/delete()/clear()/has() and the *Multiple variants all behave per the PSR-16 spec. Keys are validated (max 64 chars, [A-Za-z0-9_.]); an illegal key throws a PSR-16 InvalidArgumentException.

PSR-6 (cache item pool)

Construct a CachePool with the same drivers and use the PSR-6 item API. Items are obtained from the pool via getItem()/getItems() — never instantiated directly.

Expiration is set on the item with expiresAfter(int|\DateInterval|null) or expiresAt(?\DateTimeInterface). getItem() always returns an item (never null) — a miss is an item whose isHit() is false and whose get() is null.

Deferred writes. Queue items and flush them together with commit(). A deferred item is already visible to getItem()/hasItem() before the commit:

If you forget commit(), the pool flushes any pending deferred items in its destructor, so they are still persisted when the pool is garbage-collected or the request ends — per PSR-6's guarantee that deferred items are not lost.

Illegal keys throw a Psr\Cache\InvalidArgumentException. Because the exception implements both PSR interfaces, the PSR-16 and PSR-6 facades can share one driver and interoperate — a value written through one reads back through the other.

Drivers

All drivers implement PhpPico\Caching\Driver\Driver and are interchangeable between the PSR-16 Cache and the PSR-6 CachePool.

Driver Backing store Persistence Notes
StaticDriver in-memory array current request only great for tests; nothing survives the request
NoopDriver none never discards writes, always misses — disables caching transparently
FilesystemDriver JSON files on disk durable TTL enforced on read; guards against directory traversal
RedisDriver Redis / Valkey over a socket durable hand-rolled RESP2, TTL via EXAT, optional reconnect

RedisDriver

RedisDriver speaks the RESP2 protocol directly over a TCP stream — it needs no ext-redis or other extension. Because it only depends on RESP2, it works with Redis, Valkey, and any other RESP2-compatible server (KeyDB, DragonflyDB, etc.). It is validated against Redis 8.x/7.x/6.x and Valkey 9.x/8.x/7.x.

A RedisDriver takes a RedisConnection, built one of two ways.

From connection details — dials Redis lazily on first use:

From an existing stream — bring your own socket (e.g. a pre-opened, pooled, or already-authenticated connection):

Selecting a database

build() selects its database automatically on first use (a fresh connection starts on db 0, so a SELECT is only sent when database > 0). A connection built from a supplied stream is not auto-selected — call select() yourself:

Reconnection

On a dropped connection (server restart, failover, idle kill), RedisDriver transparently reconnects and replays the failed command, up to reconnectTries times with a short backoff between attempts. This matters for long-lived runtimes (FrankenPHP, ReactPHP, Swoole, queue workers) where a single connection is reused across many requests; classic per-request PHP-FPM rarely needs it.

Only commands that are safe to run twice are replayed — every command this driver issues is idempotent (GET/SET/DEL/MSET/MSETEX/EXISTS/ FLUSHDB, with writes using an absolute EXAT so a delayed replay does not drift the TTL). A protocol error (a Redis -ERR reply) is never retried. A connection built from a supplied stream cannot re-dial, so it surfaces the failure instead of reconnecting.

Set reconnectTries: 0 to disable reconnection. A transport failure that cannot be recovered throws PhpPico\Caching\Driver\Redis\Exceptions\RedisConnectionException (a subclass of the PSR-16 CacheException).

Custom drivers

Implement PhpPico\Caching\Driver\Driver. Drivers operate on already-serialized string payloads and an absolute ?int $expiresAt timestamp — the facades handle key validation and (de)serialization. The DriverTrait provides naive multi-key operations built on the single-key methods, so a driver only has to implement get/set/delete/clear/has. A new driver works with both the PSR-16 and PSR-6 facades automatically.

Development

License

MIT.


All versions of caching with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
psr/simple-cache Version ^3.0
psr/cache Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-pico/caching contains the following files

Loading the files please wait ...