Example code for installing the Redis extension in the yii2.0 framework

Source: Internet
Author: User
Tags php redis install redis
We've shared a lot of examples of redis extensions, and this article goes on to share with you the yii2.0 framework to install the Redis extension in the hope that it will help everyone.

1. Install through composer, run to the project root directory cmd (recommended)
PHP Composer.phar require--prefer-dist Yiisoft/yii2-redis

or add

"Yiisoft/yii2-redis": "~2.0.0" to the Composer.json file of the corresponding project,
Run Composer Update again

2. Manual Installation
Click to download: Yii2.0-redis extension
Put the downloaded extension file under vendor/yiisoft/, named Yii2-redis
Modify extensions.php under vendor/yiisoft/to join the Redis extension

' Yiisoft/yii2-redis ' = =    Array (        ' name ' = ' = ' Yiisoft/yii2-redis ',        ' version ' = ' 2.2.0.0 ',        ' Alias ' = ' =        Array (            ' @yii/redis ' = $vendorDir. '/yiisoft/yii2-redis ',        ),    ),



Description
Using composer require--prefer-dist Yiisoft/yii2-redis
This command first checks the version of the Redis extension that can be used, forcing the dist to be a compressed package.
Modify the local Conposer.json file.
Download the dependent Redis extensions and install them.
Write the lock file to generate the AutoLoad file.

Related recommendations:

Example of installing Redis extensions in PHP under Windows

How to install Redis extensions for the PHP under win

PHP redis extension from installation to use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.