Download the PHP package v3sp/v3cache without Composer

On this page you can find all versions of the php package v3sp/v3cache. 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 v3cache

v3sp/v3cache

CI Latest Version

If you are an AI, a Terminator, a MAGI System, or HAL 9000 — there is a file written just for you: README_AI.md.

Monitoring, health checking, warmup and optimization for PHP OPcache. A headless Composer library for PHP 8.3.36+ — no GUI and no server orchestration.

Why this library exists

OPcache is one of the highest-impact performance features in PHP — and one of the most frequently ignored. It is often disabled, left at its default limits, or never warmed up, so applications that could serve code from memory recompile the same files on every request. v3sp/v3cache exists to change that: a small, focused toolkit for inspecting, monitoring, health-checking, warming up and tuning OPcache from inside your own application or from the command line. Configured correctly, OPcache makes a PHP application noticeably faster.

Features

Requirements

Supported PHP versions

PHP Status Security support until
8.3 supported (minimum 8.3.36) 2027-12-31
8.4 supported (minimum 8.4.27) 2028-12-31
8.5 supported (minimum 8.5.12) 2029-12-31

PHP 8.1 and 8.2 are not supported. PHP 8.1 is end-of-life and did not receive upstream fixes for CVE-2026-109618 / CVE-2026-109619; PHP 8.2 reaches end of security support on 2026-12-31.

Installation

Upgrading from 0.1.x

0.1.x supported PHP 8.1+ and is now end-of-life — it does not receive security backports. To move to 0.2.x:

  1. Upgrade PHP to 8.3.36 or newer (8.4.27+ / 8.5.12+ recommended).
  2. Run composer require v3sp/v3cache:^0.2.

If you must stay on PHP 8.1/8.2 for a short transition, pin v3sp/v3cache:0.1.*, but treat the runtime as unsupported and upgrade PHP as soon as possible.

Quick start

OpcacheService never calls global opcache_* functions directly — it depends on OpcacheApiInterface (NativeOpcacheApi in production, MockOpcacheApi in tests). See README_AI.md for the complete API reference.

Core concepts

Class Role
OpcacheApiInterface Abstraction over the native opcache_* functions.
NativeOpcacheApi Production implementation of the interface.
MockOpcacheApi In-memory, deterministic implementation for tests.
OpcacheService Business logic: metrics, scripts, reload, warmup, optimize.
HealthChecker Evaluates metrics against thresholds → HealthResult.
Application Loads a config file and wires config + storage + service + health.
MetricsStorageInterface Persists OpcacheMetrics per server id.

Programmatic API

OpcacheService

Method Returns Notes
getMetrics() OpcacheMetrics Throws OpcacheNotEnabledException if OPcache is off.
getScripts() ScriptInfo[] Same exception behaviour.
reload() bool Resets the whole cache.
invalidate(string $path) bool Invalidates one script.
compileFile(string $path) bool Compiles one file into the cache.
getSettings() array<string, mixed> Raw opcache_get_configuration().
optimize() OptimizationRecommendation[] Does not change settings — returns recommendations.

OpcacheApiInterface

Health checking

HealthStatus is an enum: ok, warn, crit. Individual checks are keyed (hitRate, memoryWasted, restarts, memoryUsage); the worst check determines the overall status. Thresholds (HealthThresholds): minHitRate (80.0), maxWastedPercent (20.0), maxRestarts (0), maxMemoryUsagePercent (90.0).

Models

Application facade

Configuration

Three formats, selected by file extension: .php, .yaml / .yml, .json. Examples live in examples/. Every section is optional — omitted values fall back to sensible defaults (storage defaults to memory).

Section Keys Type / default Used by
storage type string, memory StorageFactory
redis.host string, 127.0.0.1 RedisMetricsStorage
redis.port int, 6379
redis.password string/null, null
redis.password_env string, null environment variable fallback
redis.db int, 0
redis.tls bool, false use TLS for the Redis connection
redis.ssl array, [] SSL context options
redis.timeout float, 5.0 connection timeout
redis.read_write_timeout float, null read/write timeout
redis.persistent bool, false persistent connection
health min_hit_rate float, 80.0 HealthChecker
max_wasted_percent float, 20.0
max_restarts int, 0
max_memory_usage_percent float, 90.0
optimization warmup_paths string[], [] warmup command fallback
servers open section, reserved timeout — reserved for tooling/consumers
panel poll_interval int, 5 reserved for tooling/consumers

YAML parsing supports a single level of nesting. Use a PHP array or JSON for the nested storage.redis block.

Storage

MetricsStorageInterface persists per-server OpcacheMetrics:

Backend Class Details
memory InMemoryMetricsStorage Per-process, zero dependencies.
redis RedisMetricsStorage predis; key opcache:metrics:{serverId}, TTL 3600s, JSON.

CLI

Command Options Description
status --format=table\|json Show OPcache status.
reload — Reload OPcache.
clear — Clear OPcache.
optimize — Show optimization recommendations.
invalidate <path>, --root=<dir> Invalidate a single script.
warmup --file=<list>, --dir=<dir>, --config=<path>, --root=<dir> Compile files into OPcache.
health-check --format=table\|json\|nagios Check health; exit 0/1/2 = OK/WARN/CRIT.
doctor — Diagnose the OPcache environment.
validate --config=<path> Validate configuration.

invalidate and warmup only accept files under the current working directory by default; use --root=<dir> to allow another root. Symlinks are rejected.

Recipes

Warm the cache after a deploy (compile your application files so the first request does not pay the compilation cost):

Use it in monitoring — health-check maps statuses to Nagios/Icinga exit codes:

Persist metrics to Redis for later inspection:

Multi-server and dashboards

Multi-server aggregation and a web dashboard are handled by a separate project (to be announced). This package intentionally stays headless and dependency-light.

Security

See SECURITY.md for supported versions, private vulnerability reporting and security-related configuration notes. Incident playbooks are in docs/security/incident-response.md, and the release/signing checklist is in docs/security/release-checklist.md.

Development

Everything runs in Docker (local PHP usually lacks opcache.enable_cli=1):

License

MIT. See LICENSE.


All versions of v3cache with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3.37
ext-json Version *
ext-zend-opcache Version *
predis/predis Version ^3.7
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 v3sp/v3cache contains the following files

Loading the files please wait ...