PHPackages                             valkey-io/valkey-glide-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. valkey-io/valkey-glide-php

ActivePhp-ext

valkey-io/valkey-glide-php
==========================

Valkey GLIDE for PHP

v1.0.0(3mo ago)271799[25 issues](https://github.com/valkey-io/valkey-glide-php/issues)[14 PRs](https://github.com/valkey-io/valkey-glide-php/pulls)Apache-2.0CPHP &gt;=8.1CI passing

Since Jul 24Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/valkey-io/valkey-glide-php)[ Packagist](https://packagist.org/packages/valkey-io/valkey-glide-php)[ Docs](https://github.com/valkey-io/valkey-glide-php)[ RSS](/packages/valkey-io-valkey-glide-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (5)Versions (55)Used By (0)

Welcome to Valkey GLIDE PHP
===========================

[](#welcome-to-valkey-glide-php)

GLIDE is the official open-source Valkey client library, proudly part of the Valkey organization. Our mission is to make your experience with Valkey and Redis OSS seamless and enjoyable. Whether you're a seasoned developer or just starting out, Valkey GLIDE is here to support you every step of the way.

**`valkey-glide-php`** is the PHP binding for Valkey GLIDE. It brings the power and flexibility of the Valkey GLIDE core to the PHP ecosystem, with a familiar and convenient interface based on the popular [PHPRedis](https://github.com/phpredis/phpredis) API. By providing a drop-in replacement client for PHPRedis, this client offers an easy migration path and minimal learning curve—while adding the features of Valkey GLIDE.

Why Choose Valkey GLIDE?
------------------------

[](#why-choose-valkey-glide)

- **Community and Open Source**: Join our vibrant community and contribute to the project. We are always here to respond, and the client is for the community.
- **Reliability**: Built with best practices learned from over a decade of operating Redis OSS-compatible services.
- **Performance**: Optimized for high performance and low latency.
- **High Availability**: Designed to ensure your applications are always up and running.
- **Cross-Language Support**: Implemented using a core driver framework written in Rust, with language-specific extensions to ensure consistency and reduce complexity.
- **Stability and Fault Tolerance**: We brought our years of experience to create a bulletproof client.
- **Backed and Supported by AWS and GCP**: Ensuring robust support and continuous improvement of the project.

Key Features
------------

[](#key-features)

- **[Cluster-Aware MGET/MSET/DEL/FLUSHALL](https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#multi-slot-command-handling:~:text=Multi%2DSlot%20Command%20Execution,JSON.MGET)** – Execute multi-key commands across cluster slots without manual key grouping.
- **[Cluster Scan](https://github.com/valkey-io/valkey-glide/wiki/General-Concepts#cluster-scan)** – Unified key iteration across shards using a consistent, high-level API for cluster environments.

Experimental Features
---------------------

[](#experimental-features)

- **Compression** – The compression feature is currently experimental. We are actively expanding this feature, and detailed documentation around risks and usage will be updated soon.

Supported Engine Versions
-------------------------

[](#supported-engine-versions)

Valkey GLIDE is API-compatible with the following engine versions:

Engine Type6.27.07.17.28.08.19.0Valkey---VVVVRedisVVVV---Getting Started - PHP Wrapper
-----------------------------

[](#getting-started---php-wrapper)

### System Requirements

[](#system-requirements)

The release of Valkey GLIDE was tested on the following platforms:

Linux:

- Ubuntu 20 (x86\_64/amd64 and arm64/aarch64)

**Note: Currently Alpine Linux / MUSL is NOT supported.**

macOS:

- macOS 14.7 (Apple silicon/aarch\_64)

### PHP Supported Versions

[](#php-supported-versions)

PHP Version8.28.3### Installation and Setup

[](#installation-and-setup)

#### Prerequisites

[](#prerequisites)

Before installing Valkey GLIDE PHP extension, ensure you have the following dependencies:

- PHP development headers (`php-dev` or `php-devel`)
- Build tools (`gcc`, `make`, `autotools`)
- Git
- pkg-config
- protoc (protobuf compiler) &gt;= v3.20.0
- openssl and openssl-dev
- rustup (Rust toolchain)
- php-bcmath (Protobuf PHP dependency, needed only for testing)

#### Installing Dependencies

[](#installing-dependencies)

**Ubuntu/Debian:**

```
sudo apt update -y
sudo apt install -y php-dev php-cli git gcc make autotools-dev pkg-config openssl libssl-dev unzip php-bcmath
# Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
```

**CentOS/RHEL:**

```
sudo yum update -y
sudo yum install -y php-devel php-cli git gcc make pkgconfig openssl openssl-devel unzip php-bcmath
# Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
```

**macOS:**

```
brew update
brew install php git gcc make pkgconfig protobuf openssl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
```

#### Installing protobuf compiler

[](#installing-protobuf-compiler)

**For macOS:**

```
brew install protobuf
brew install protobuf-c
# Verify installation
protoc --version
```

**For Linux:**

```
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip
unzip protoc-3.20.3-linux-x86_64.zip -d $HOME/.local
export PATH="$PATH:$HOME/.local/bin"
# Verify installation (minimum version 3.20.0 required)
protoc --version
```

### Installing from Packagist

[](#installing-from-packagist)

You can use pie to install the extension from the Packagist repository. See:

Before starting this step, make sure you've installed all dependencies above.

Additionally, you will need to install the pie tool.

On Linux, you can download pie with curl. eg:

```
curl -L https://github.com/php/pie/releases/latest/download/pie.phar -o pie
chmod +x pie
sudo mv pie /usr/local/bin/pie
export PATH="$PATH:/usr/local/bin"
```

On MacOS, install with Homebrew:

```
brew install pie
```

To install the Valkey Glide extension, simply use the pie command:

```
# VERSION can be set to any release tag or branch at https://github.com/valkey-io/valkey-glide-php.git
export VERSION=1.0.0
pie install valkey-io/valkey-glide-php:$VERSION
```

### Installing from PECL

[](#installing-from-pecl)

You can install the extension using PECL from GitHub releases:

```
# Download the package
curl -L https://github.com/valkey-io/valkey-glide-php/releases/download/v1.0.0/valkey_glide-1.0.0.tgz -o valkey_glide-1.0.0.tgz

# Install with PECL
pecl install valkey_glide-1.0.0.tgz
```

After installation, add the extension to your php.ini:

```
extension=valkey_glide
```

Verify the installation:

```
php -m | grep valkey_glide
php -r "if (extension_loaded('valkey_glide')) echo 'SUCCESS: Extension loaded!'; else echo 'ERROR: Extension not loaded';"
```

#### Building and Installing the Extension from source

[](#building-and-installing-the-extension-from-source)

1. Clone the repository:

    ```
    git clone --recurse-submodules https://github.com/valkey-io/valkey-glide-php.git
    cd valkey-glide-php
    ```
2. Initialize submodules (if not cloned with --recurse-submodules):

    ```
    git submodule update --init --recursive
    ```
3. Build the FFI library (required dependency):

    ```
    python3 utils/patch_proto_and_rust.py
    cd valkey-glide/ffi
    cargo build --release
    cd ../../
    ```
4. Build the extension:

    ```
    phpize
    ./configure --enable-valkey-glide
    make build-modules-pre
    make install
    ```
5. Enable the extension by adding it to your `php.ini` file:

    ```
    extension=valkey_glide
    ```
6. Generate PHP protobuf classes used for testing purposes:

    ```
    protoc --proto_path=./valkey-glide/glide-core/src/protobuf --php_out=./tests/ ./valkey-glide/glide-core/src/protobuf/connection_request.proto
    ```
7. Install PHP dependencies with composer:

    ```
    composer install --no-interaction --prefer-dist --optimize-autoloader
    ```
8. Execute the tests:

    ```
    make test
    ```

Basic Examples
--------------

[](#basic-examples)

### Standalone Valkey

[](#standalone-valkey)

```
// Create ValkeyGlide client
$client = new ValkeyGlide();
$client->connect(addresses: [['host' => 'localhost', 'port' => 6379]]);

// Basic operations
$setResult = $client->set('foo', 'bar');
echo "SET result: " . $setResult . "\n";

$getValue = $client->get('foo');
echo "GET result: " . $getValue . "\n";

$pingResult = $client->ping();
echo "PING result: " . $pingResult . "\n";

// Close the connection
$client->close();
```

### PHPRedis-Compatible Class Names

[](#phpredis-compatible-class-names)

For easier migration from PHPRedis, you can use PHPRedis-compatible class names:

**Standalone:**

```
// Register PHPRedis compatibility aliases
ValkeyGlide::registerPHPRedisAliases();

// Now you can use Redis instead of ValkeyGlide
$client = new Redis();
$client->connect(addresses: [['host' => 'localhost', 'port' => 6379]]);

$client->set('foo', 'bar');
$value = $client->get('foo');

// Exceptions are also aliased
try {
    // Operations that may fail
} catch (RedisException $e) {
    echo "Caught RedisException: " . $e->getMessage() . "\n";
}

$client->close();
```

**Cluster:**

```
// Register PHPRedis compatibility aliases
ValkeyGlide::registerPHPRedisAliases();

// Now you can use RedisCluster instead of ValkeyGlideCluster
$cluster = new RedisCluster(
    addresses: [
        ['host' => 'localhost', 'port' => 7001],
        ['host' => 'localhost', 'port' => 7002]
    ]
);

$cluster->set('foo', 'bar');
$value = $cluster->get('foo');

$cluster->close();
```

**Requirements:**

- PHP 8.3 or higher (required for `class_alias()` support with internal classes)

### With IAM Authentication for AWS ElastiCache

[](#with-iam-authentication-for-aws-elasticache)

```
// Create ValkeyGlide client with IAM authentication.
$client = new ValkeyGlide();
$client->connect(
    addresses: [['host' => 'my-cluster.xxxxx.use1.cache.amazonaws.com', 'port' => 6379]],
    use_tls: true,  // REQUIRED for IAM authentication
    credentials: [
        'username' => 'my-iam-user',  // REQUIRED for IAM
        'iamConfig' => [
            ValkeyGlide::IAM_CONFIG_CLUSTER_NAME => 'my-cluster',
            ValkeyGlide::IAM_CONFIG_REGION => 'us-east-1',
            ValkeyGlide::IAM_CONFIG_SERVICE => ValkeyGlide::IAM_SERVICE_ELASTICACHE,
            ValkeyGlide::IAM_CONFIG_REFRESH_INTERVAL => 300  // Optional, defaults to 300 seconds
        ]
    ]
);

// Use the client normally - IAM tokens are managed automatically
$client->set('key', 'value');
$value = $client->get('key');
echo "Value: " . $value . "\n";

$client->close();
```

### With TLS

[](#with-tls)

```
// Create ValkeyGlide client with TLS configuration
$client = new ValkeyGlide();
$client->connect(
    addresses: [['host' => 'localhost', 'port' => 6379]],
    use_tls: true,
    advanced_config: ['tls_config' => ['root_certs' => $root_certs_data]]
);

// Create ValkeyGlide client with TLS stream context
$client = new ValkeyGlide();
$client->connect(
    addresses: [['host' => 'localhost', 'port' => 6379]],
    context: stream_context_create(['ssl' => 'ca-cert.pem'])
)
```

### Cluster Valkey

[](#cluster-valkey)

```
// Create cluster client configuration
$addresses = [
    ['host' => 'localhost', 'port' => 7001],
    ['host' => 'localhost', 'port' => 7002],
    ['host' => 'localhost', 'port' => 7003]
];

// Create ValkeyGlideCluster client with multi-database support (Valkey 9.0+)
$client = new ValkeyGlideCluster(
    addresses: $addresses,
    read_from: ValkeyGlide::READ_FROM_PREFER_REPLICA,
    database_id: 1 // Requires Valkey 9.0+ with cluster-databases > 1
);

// Basic operations
$setResult = $client->set('foo', 'bar');
echo "SET result: " . $setResult . "\n";

$getValue = $client->get('foo');
echo "GET result: " . $getValue . "\n";

$pingResult = $client->ping();
echo "PING result: " . $pingResult . "\n";

// Close the connection
$client->close();
```

Building &amp; Testing
----------------------

[](#building--testing)

Development instructions for local building &amp; testing the package are in the [DEVELOPER.md](DEVELOPER.md) file.

Contributing
------------

[](#contributing)

GitHub is a platform for collaborative coding. If you're interested in writing code, we encourage you to contribute by submitting pull requests from forked copies of this repository. Additionally, please consider creating GitHub issues for reporting bugs and suggesting new features. Feel free to comment on issues that interest. For more info see [Contributing](./CONTRIBUTING.md).

All contributions are automatically validated through our CI pipeline, ensuring:

- Code style compliance
- All tests passing across supported PHP versions
- Memory leak detection and performance benchmarks

Get Involved
------------

[](#get-involved)

We invite you to join our open-source community and contribute to Valkey GLIDE. Whether it's reporting bugs, suggesting new features, or submitting pull requests, your contributions are highly valued. Check out our [Contributing Guidelines](./CONTRIBUTING.md) to get started.

If you have any questions or need assistance, don't hesitate to reach out. Open a GitHub issue, and our community and contributors will be happy to help you.

Community Support and Feedback
------------------------------

[](#community-support-and-feedback)

We encourage you to join our community to support, share feedback, and ask questions. You can approach us for anything on our Valkey Slack: [Join Valkey Slack](https://join.slack.com/t/valkey-oss-developer/shared_invite/zt-2nxs51chx-EB9hu9Qdch3GMfRcztTSkQ).

License
-------

[](#license)

- [Apache License 2.0](./LICENSE)

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance68

Regular maintenance activity

Popularity27

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Recently: every ~1 days

Total

11

Last Release

103d ago

Major Versions

v0.10.0-rc3 → v1.0.0-rc12026-01-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/25353b4ebe28758148ae8d4c33e5e9d17c41f52ced59dba4ba41db57286e6f7d?d=identicon)[valkey-glide-maintainers](/maintainers/valkey-glide-maintainers)

---

Top Contributors

[![asafpamzn](https://avatars.githubusercontent.com/u/97948347?v=4)](https://github.com/asafpamzn "asafpamzn (131 commits)")[![jduo](https://avatars.githubusercontent.com/u/1657237?v=4)](https://github.com/jduo "jduo (34 commits)")[![prateek-kumar-improving](https://avatars.githubusercontent.com/u/178204713?v=4)](https://github.com/prateek-kumar-improving "prateek-kumar-improving (18 commits)")[![currantw](https://avatars.githubusercontent.com/u/181785993?v=4)](https://github.com/currantw "currantw (5 commits)")[![affonsov](https://avatars.githubusercontent.com/u/67347924?v=4)](https://github.com/affonsov "affonsov (4 commits)")[![KIvanow](https://avatars.githubusercontent.com/u/541999?v=4)](https://github.com/KIvanow "KIvanow (3 commits)")[![alexr-bq](https://avatars.githubusercontent.com/u/72045206?v=4)](https://github.com/alexr-bq "alexr-bq (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/valkey-io-valkey-glide-php/health.svg)

```
[![Health](https://phpackages.com/badges/valkey-io-valkey-glide-php/health.svg)](https://phpackages.com/packages/valkey-io-valkey-glide-php)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
