Alpha ZealPHP is early-stage and under active development. APIs may change between minor versions until v1.0. Feedback and bug reports welcome on GitHub.
API Index — Namespaces, Packages, Reports, Indices

DriverPreference : string
in package

Type-safe enum for RedisClient's driver selection. Accepted by Store::defaultBackend() via the 'prefer' opt and by RedisClient::__construct()'s opts array.

Store::defaultBackend(StoreBackendKind::Redis, [
    'prefer' => DriverPreference::Predis,   // typed form
]);
// or the BC string form:
Store::defaultBackend('redis', ['prefer' => 'predis']);

Table of Contents

Cases

Auto  = 'auto'
Auto-detect: prefer ext-redis (phpredis) when loaded, fall back to predis.
Phpredis  = 'phpredis'
Force the ext-redis (phpredis) extension. Throws if not loaded.
Predis  = 'predis'
Force the pure-PHP predis library.

Methods

coerce()  : self
Coerce a string or existing DriverPreference case to a DriverPreference.

Cases

Auto

Auto-detect: prefer ext-redis (phpredis) when loaded, fall back to predis.

Phpredis

Force the ext-redis (phpredis) extension. Throws if not loaded.

Methods

coerce()

Coerce a string or existing DriverPreference case to a DriverPreference.

public static coerce(self|string $pref) : self

Accepts 'auto', 'phpredis', or 'predis' (case-insensitive).

Parameters
$pref : self|string
Tags
throws
InvalidArgumentException

on an unrecognised string.

Return values
self
On this page