# Predis guide (PHP)

```json metadata
{
  "title": "Predis guide (PHP)",
  "description": "Connect your PHP application to a Redis database",
  "categories": ["docs","develop","stack","oss","rs","rc","oss","kubernetes","clients"],
  "tableOfContents": {"sections":[{"id":"install","title":"Install"},{"id":"connect-and-test","title":"Connect and test"},{"id":"more-information","title":"More information"}]}
}
```














[`Predis`](https://github.com/predis/predis) is the recommended [PHP](https://php.net/)
client for Redis. 
The sections below explain how to install `Predis` and connect your application to a Redis database.

Although we provide basic documentation for `Predis`, it is a third-party
client library and is not developed or supported directly by Redis.


`Predis` requires a running Redis server. See [here](https://redis.io/docs/latest/operate/oss_and_stack/install/) for Redis Open Source installation instructions.

## Install

Use [Composer](https://getcomposer.org/) to install the `Predis` library
with the following command line:

```bash
composer require predis/predis
```

## Connect and test

Connect to a locally-running server on the standard port (6379)
with the following code:




Store and retrieve a simple string to test the connection:




Store and retrieve a [hash](https://redis.io/docs/latest/develop/data-types/hashes)
object:




## More information

The [Predis wiki on Github](https://github.com/predis/predis/wiki) has
information about the different connection options you can use.

See also the pages in this section for more information and examples:
