Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Docs/split #2642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: develop
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
063198b
Valkey-PHP
rlunar Mar 21, 2025
4263473
Update README.md
rlunar Mar 21, 2025
c29ef42
Update .gitignore
rlunar Mar 21, 2025
5ddc8be
Update README with Pre-requisites
Mar 21, 2025
924d16c
Update README with Pre-requisites
Mar 21, 2025
dfed6a0
MD048/code-fence-style: Code fence style [Expected: backtick; Actual:…
Mar 24, 2025
df8eb29
MD031/blanks-around-fences: Fixed | MD040/fenced-code-language: Fixed
Mar 25, 2025
a3b9bb3
MD033/no-inline-html
Mar 26, 2025
d1644c6
MD022/blanks-around-headings: Headings should be surrounded by blank …
Mar 26, 2025
7458082
MD001/heading-increment: Heading levels should only increment by one …
Mar 26, 2025
45c148a
docs/usage
Mar 26, 2025
99f7c4a
Merge branch 'phpredis:develop' into develop
rlunar Mar 26, 2025
90ccaa8
Fix test IfEq
adrianluna Mar 26, 2025
650b203
Fix high port test
adrianluna Mar 26, 2025
02b74ee
Fix tls connect test
adrianluna Mar 26, 2025
5738836
Merge pull request #1 from rlunar/docs/usage
rlunar Mar 26, 2025
53fcb86
Merge pull request #2 from adrianluna/fix/test-suite
rlunar Mar 26, 2025
558bebf
Merge remote-tracking branch 'origin/main'
Mar 26, 2025
774cd6f
Merge pull request #3 from rlunar/main
rlunar Mar 26, 2025
c6a854f
Split README file into multiple markdown files for easier readability…
Mar 26, 2025
091ef47
Split README file into multiple markdown files for easier readability…
Mar 26, 2025
fac7e92
Documentation | Bitmaps
Mar 26, 2025
0a8ed67
Documentation | Bitmaps
Mar 26, 2025
f315bbc
Documentation | Bitmaps | BitPos
Mar 26, 2025
edb8a75
Documentation | Geospatial indexes
Mar 26, 2025
db32af9
Documentation | Hashes
Mar 26, 2025
b84e1dd
Documentation | Hashes | HyperLogLogs
Mar 26, 2025
0b3bb04
Documentation | Introspection
Mar 26, 2025
a47e0bd
Documentation | Introspection
Mar 26, 2025
f0401de
Documentation | Keys
Mar 26, 2025
c3db4bb
Documentation | Lists
Mar 26, 2025
907f6dc
Documentation | Pub/Sub
Mar 26, 2025
530f5f2
Documentation | Scripting
Mar 26, 2025
56cbfd4
Documentation | Sets
Mar 27, 2025
d735a30
Documentation | Sorted Sets
Mar 27, 2025
bdaadac
Documentation | Streams
Mar 27, 2025
656b85e
Make test suite redis compatible
adrianluna Mar 26, 2025
ed6aa5f
Documentation | Strings
Mar 27, 2025
bd3a794
Documentation | Transactions
Mar 27, 2025
86126ae
Documentation | README
Mar 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
MD033/no-inline-html
  • Loading branch information
Roberto Luna Rojas committed Mar 26, 2025
commit a3b9bb3957a9a627802148dd93dc474d230fc513
1 change: 1 addition & 0 deletions 1 INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ zypper in php7-redis
# Installation on OSX

If the install fails on OSX, type the following commands in your shell before trying again:

```bash
MACOSX_DEPLOYMENT_TARGET=10.6
CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp"
Expand Down
60 changes: 32 additions & 28 deletions 60 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ brew install autoconf automake libtool php
### PHP Extension (Recommended for Production)

```bash
pecl install valkey-php
pecl install valkey
```

Add the following to your php.ini:
Expand Down Expand Up @@ -111,9 +111,9 @@ Valkey-PHP provides Redisson-like abstractions for complex data structures:
We provide compatibility layers to make migration from either library as smooth as possible:

```php
// For phpredis users
use Valkey\Compat\PhpRedis;
$redis = new PhpRedis();
// For PHPRedis users
use Valkey\Compat\Redis;
$redis = new Redis();

// For webdcg/redis users
use Valkey\Compat\WebdcgRedis;
Expand All @@ -122,7 +122,7 @@ $redis = new WebdcgRedis();

## Documentation

Comprehensive documentation is available at [valkey-php.io/docs](https://valkey-php.io/docs)
Comprehensive documentation is available at [valkey-php.dev/docs](https://valkey-php.dev/docs)

## Contributing

Expand Down Expand Up @@ -173,53 +173,57 @@ It is released under the [PHP License, version 3.01](http://www.php.net/license/

You can send comments, patches, questions [here on github](https://github.com/phpredis/phpredis/issues), to michael.grunder@gmail.com ([Twitter](https://twitter.com/grumi78), <a rel="me" href="https://phpc.social/@mgrunder">Mastodon</a>), p.yatsukhnenko@gmail.com ([@yatsukhnenko](https://twitter.com/yatsukhnenko)), or n.favrefelix@gmail.com ([@yowgi](https://twitter.com/yowgi)).


## [API Documentation](https://phpredis.github.io/phpredis)
These are a work in progress, but will eventually replace our **ONE README TO RULE THEM ALL** docs.

## Supporting the project

PhpRedis will always be free and open source software, but if you or your company has found it useful please consider supporting the project. Developing a large, complex, and performant library like PhpRedis takes a great deal of time and effort, and support would be appreciated! :heart:

The best way to support the project is through [GitHub sponsors](https://github.com/sponsors/michael-grunder). Many of the reward tiers grant access to our [slack channel](https://phpredis.slack.com) where [myself](https://github.com/michael-grunder) and [Pavlo](https://github.com/yatsukhnenko) are regularly available to answer questions. Additionally this will allow you to provide feedback on which fixes and new features to prioritize.

You can also make a one-time contribution with [![PayPal](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/michaelgrunder/5)

## Sponsors

<a href="https://audiomack.com"><img src="https://styleguide.audiomack.com/assets/dl/inline-orange-large.png" align="center" alt="Audiomack.com" width="150"></a>
<a href="https://bluehost.com"><img src="https://upload.wikimedia.org/wikipedia/commons/2/22/Bluehost-logo.png" align="center" alt="Bluehost.com" width="150"></a>
<a href="https://objectcache.pro"><img src="https://objectcache.pro/assets/wordmark-padded.png" align="center" alt="Object Cache Pro" width="150"></a>
<a href="https://openlms.net"><img src="https://help.openlms.net/wp-content/uploads/2020/05/cropped-open-lms.png" align="center" alt="OpenLMS.net" width="150"></a>

# Table of contents
## Table of contents

-----
1. [Installing/Configuring](#installingconfiguring)
* [Installation](#installation)
* [PHP Session handler](#php-session-handler)

1. [Installing/Configuring](docs/content/README.md#installingconfiguring)
* [Installation](docs/content/installation.md)
* [PHP Session handler](docs/content/php.md-session-handler)
* [Distributed Redis Array](./arrays.md#readme)
* [Redis Cluster support](./cluster.md#readme)
* [Redis Sentinel support](./sentinel.md#readme)
* [Running the unit tests](#running-the-unit-tests)
1. [Classes and methods](#classes-and-methods)
* [Usage](#usage)
* [Connection](#connection)
* [Retry and backoff](#retry-and-backoff)
* [Server](#server)
* [Keys and strings](#keys-and-strings)
* [Hashes](#hashes)
* [Lists](#lists)
* [Sets](#sets)
* [Sorted sets](#sorted-sets)
* [HyperLogLogs](#hyperloglogs)
* [Geocoding](#geocoding)
* [Streams](#streams)
* [Pub/sub](#pubsub)
* [Transactions](#transactions)
* [Scripting](#scripting)
* [Introspection](#introspection)
* [Running the unit tests](docs/content/running.md-the-unit-tests)
2. [Classes and methods](docs/content/classes.md-and-methods)
* [Usage](docs/content/usage.md)
* [Connection](docs/content/connection.md)
* [Retry and backoff](docs/content/retry.md-and-backoff)
* [Server](docs/content/server.md)
* [Keys and strings](docs/content/keys.md-and-strings)
* [Hashes](docs/content/hashes.md)
* [Lists](docs/content/lists.md)
* [Sets](docs/content/sets.md)
* [Sorted sets](docs/content/sorted.md-sets)
* [HyperLogLogs](docs/content/hyperloglogs.md)
* [Geocoding](docs/content/geocoding.md)
* [Streams](docs/content/streams.md)
* [Pub/sub](docs/content/pubsub.md)
* [Transactions](docs/content/transactions.md)
* [Scripting](docs/content/scripting.md)
* [Introspection](docs/content/introspection.md)

-----

# Installing/Configuring

-----

## Installation
Expand Down
108 changes: 108 additions & 0 deletions 108 docs/content/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Valkey PHP - Readme

## Installing/Configuring

-----

### Installation

For everything you should need to install PhpRedis on your system,
see the [INSTALL.md](./INSTALL.md) page.

### PHP Session handler

phpredis can be used to store PHP sessions. To do this, configure `session.save_handler` and `session.save_path` in your php.ini to tell phpredis where to store the sessions.

`session.save_path` can have a simple `host:port` format too, but you need to provide the `tcp://` scheme if you want to use the parameters. The following parameters are available:

- __weight__ (integer): the weight of a host is used in comparison with the others in order to customize the session distribution on several hosts. If host A has twice the weight of host B, it will get twice the amount of sessions. In the example, *host1* stores 20% of all the sessions (1/(1+2+2)) while *host2* and *host3* each store 40% (2/(1+2+2)). The target host is determined once and for all at the start of the session, and doesn't change. The default weight is 1.
- __timeout__ (float): the connection timeout to a redis host, expressed in seconds. If the host is unreachable in that amount of time, the session storage will be unavailable for the client. The default timeout is very high (86400 seconds).
- __persistent__ (integer, should be 1 or 0): defines if a persistent connection should be used.
- __prefix__ (string, defaults to "PHPREDIS_SESSION:"): used as a prefix to the Redis key in which the session is stored. The key is composed of the prefix followed by the session ID.
- __auth__ (string, or an array with one or two elements): used to authenticate with the server prior to sending commands.
- __database__ (integer): selects a different database.

Sessions have a lifetime expressed in seconds and stored in the INI variable "session.gc_maxlifetime". You can change it with [`ini_set()`](http://php.net/ini_set).
The session handler requires a version of Redis supporting `EX` and `NX` options of `SET` command (at least 2.6.12).
phpredis can also connect to a unix domain socket: `session.save_path = "unix:///var/run/redis/redis.sock?persistent=1&weight=1&database=0"`.

#### Examples

Multiple Redis servers:

```ini
session.save_handler = redis
session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2&read_timeout=2.5"
```

Login to Redis using username and password:

```ini
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379?auth[]=user&auth[]=password"
```

Login to Redis using username, password, and set prefix:

```ini
session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379?auth[]=user&auth[]=password&prefix=user_PHPREDIS_SESSION:"
```

#### Session locking

__Support__: Locking feature is currently only supported for Redis setup with single master instance (e.g. classic master/slave Sentinel environment).
So locking may not work properly in RedisArray or RedisCluster environments.

Following INI variables can be used to configure session locking:

```ini
; Should the locking be enabled? Defaults to: 0.
redis.session.locking_enabled = 1
; How long should the lock live (in seconds)? Defaults to: value of max_execution_time.
redis.session.lock_expire = 60
; How long to wait between attempts to acquire lock, in microseconds (µs)?. Defaults to: 20000
redis.session.lock_wait_time = 50000
; Maximum number of times to retry (-1 means infinite). Defaults to: 100
redis.session.lock_retries = 2000
```

#### Session compression

Following INI variables can be used to configure session compression:

```ini
; Should session compression be enabled? Possible values are zstd, lzf, lz4, none. Defaults to: none
redis.session.compression = zstd
; What compression level should be used? Compression level depends on used library. For most deployments range 1-9 should be fine. Defaults to: 3
redis.session.compression_level = 3
```

### Running the unit tests

phpredis uses a small custom unit test suite for testing functionality of the various classes. To run tests, simply do the following:

```bash
## Run tests for Redis class (note this is the default)
php tests/TestRedis.php --class Redis

## Run tests for RedisArray class
tests/mkring.sh start
php tests/TestRedis.php --class RedisArray
tests/mkring.sh stop

## Run tests for the RedisCluster class
tests/make-cluster.sh start
php tests/TestRedis.php --class RedisCluster
tests/make-cluster.sh stop

## Run tests for RedisSentinel class
php tests/TestRedis.php --class RedisSentinel
```

Note that it is possible to run only tests which match a substring of the test itself by passing the additional argument '--test <str>' when invoking.

```bash
## Just run the 'echo' test
php tests/TestRedis.php --class Redis --test echo
```
Empty file added 0 docs/content/installation.md
Empty file.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.