Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
page_type languages name description products
sample
php
Quickstart: Use Azure Cache for Redis in PHP
Learn how to interact with Azure Cache for Redis in your PHP app.
azure
azure-cache-redis

Quickstart: Use Azure Cache for Redis in PHP

This sample helps to understand how to interact with Azure Cache for Redis in your PHP application. See the accompanying article on the documentation site for details, including best practices and how to create the sample code from scratch.

Prerequisites

Install Predis

Predis is an open-source client supported by Redis organization.

Composer

Predis client available on packagist.org and distributed with Composer dependency manager. You can download Composer here.

To get Predis with Composer, simply run:

composer require predis/predis

GitHub

Predis source-code also available on GitHub repository. Feel free to check README for more information about Predis.

Run the sample

Before you run a sample script, you need to set up a Redis host and password. This values represented by following environment variables:

export REDIS_HOST=your_redis_host
export REDIS_PASSWORD=your_redis_password

After the previous steps you can run sample script from the repository root directory like this:

php quickstart/php/test.php

References