Download the PHP package flytachi/winter-redis without Composer

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

Winter Redis

Latest Version on Packagist PHP Version Require

๐Ÿ“– Documentation ยท Configuration ยท Stores ยท Streams

Pooled Redis for PHP that stays resident.

A Redis connection is one socket with a sequential protocol. In classic PHP that never mattered: a process served one request and died. A worker that lives for weeks and serves many requests at once cannot share a socket between them, and cannot afford to open one per request either. This package puts a pool in between, and gives the application stores and typed handles instead of a raw client.

Built on flytachi/winter-cpool: under Swoole every coroutine gets its own connection and returns it automatically; everywhere else a single self-maintaining connection does the same job. The calling code is identical.


Installation

Requires PHP 8.4+ and ext-redis. ext-swoole is optional: with it you get real pooling, without it the same code keeps working through one connection.


Quick start

Declare an endpoint:

Declare a slice of it:

Use it:

No connection to obtain, none to return, no select(). The connection is taken on the first command and goes back to the pool when the request ends.


What you get from it

A connection per unit of work. Two coroutines never share a socket, so commands never interleave. The return is automatic โ€” a coroutine defer, not a finally you have to remember.

A bounded number of connections. A thousand concurrent requests do not become a thousand connections: they queue, and a request fails on a timeout instead of the database answering max number of clients reached.

Connections that heal. An idle connection is probed before it is handed over, an aged one is rotated. A Redis restart stops poisoning the worker for the rest of its life.

A key prefix that means something. Several stores share one database without colliding, keys() and flush() are scoped to the store, and flush() refuses outright when there is no prefix to scope it to.

Refusals that look like refusals. phpredis reports a rejected command by returning false and parking the message on the connection; cast into a return type that becomes a counter reading 0. Here it is an exception, and the connection goes back clean.


A taste of the API


Fork safety and shutdown

reset() forgets inherited connections without closing them โ€” a fork copies descriptors, and closing would tear down the parent's socket. shutdown() is the opposite and belongs at worker exit; it is only required if background housekeeping is enabled, because a live timer keeps the reactor from draining.

Under the Winter kernel both lines are already there: Kernel::init() registers them when it sees the package, and shutdown() runs on workerExit. The snippet above is for using this package on its own.


Observability

The numbers are per worker: each worker holds its own pool. active sitting at maximum while borrowers wait is the signal to raise the ceiling โ€” or to find the request holding a connection while it waits on something else.

stats() reports coroutine pools, so outside Swoole it is empty by design: there is one self-maintaining connection per config and nothing to distribute. pingDetail() answers in both runtimes and is what a health endpoint should call.


Documentation

The user-facing documentation lives at winterframe.net/docs/redis (the link picks your language; RU and EN are both complete).

Start here

Page What it answers
Redis Why a resident application needs a pool, and what this package is made of
Configuration Endpoints, databases, timeouts, TLS, ACL users, serialization, pool size
Stores Prefixes, values, lifetimes, keys()/flush(), raw(), transactions

Structures

Page What it answers
Hashes Fields, per-field lifetimes and the server version they need
Lists Queues and stacks, capped logs, blocking reads, LMOVE recovery
Streams Event logs, consumer groups, pending entries, claiming stuck work

Operating it

Page What it answers
Connection pool How connections are handed out, how to size the pool, what each error means
CPool The pool underneath, if you need to plug another driver into it

Contributing

Internal technical notes โ€” the connection model, the driver behaviours the code works around, and the rules for adding a structure โ€” live in docs/. Read those before changing how a connection is obtained or returned.

XDEBUG_MODE=off matters: Xdebug's function observers do not survive coroutine stacks, so a green run can still exit 139.


License

MIT License. See LICENSE.


All versions of winter-redis with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-redis Version *
flytachi/winter-cpool Version ^1.2
psr/log 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 flytachi/winter-redis contains the following files

Loading the files please wait ...