Giter Site home page Giter Site logo

laravel5-php-redis's Introduction

laravel5-php-redis License

在laravel中用外观模式操作php的redis扩展类

安装php的redis扩展

  • 使用pecl安装
pecl install redis
  • 由于pecl的版本不一定是最新的,可以clone源码安装

phpredis扩展的github地址:https://github.com/phpredis/phpredis

此依赖读的redis配置跟laravel保持一样,在database.php中的redis节点

'redis' => [
        'default' => [
            'host' => '127.0.0.1',
            'port' => 6379,
        	'password' => '',
            'database' => 0,
        ],
    ]

使用步骤

  • 使用composer加载依赖
composer require hacklee/laravel5-php-redis

或修改composer.json,在require加上 "hacklee/laravel5-php-redis": "dev-master" 然后执行composer update

  • 在app.php的providers节点下增加以下代码
Hacklee\PRedisServiceProvider::class

'Hacklee\PRedisServiceProvider'
  • 在app.php的aliases节点下增加以下代码
'PRedis' => Hacklee\PRedisFacade::class

'PRedis' => 'Hacklee\PRedisFacade'

使用示例

  • 直接使用
$val = \PRedis::get('key');
  • 或命名空间
use PRedis;

$val = PRedis::get('key');

redis扩展的更多操作,请参考官网文档phpredis

laravel5-php-redis's People

Contributors

hacklee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

zhucheer

laravel5-php-redis's Issues

Could not find package hacklee/laravel5-php-redis at any version...

Running:

composer require hacklee/laravel5-php-redis

Produces:

[InvalidArgumentException]                                                             
Could not find package hacklee/laravel5-php-redis at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability  

I think to fix this problem you need to run:

git tag 1.0
git push origin --tags

And you should see a 1.0 version (in addition to dev-master) in your Packagist page, as long as you're Packagist account is set to auto-update with a GitHub push.

Here's an example of one of mine:
https://packagist.org/packages/revolverobotics/helper-tools

Note: I am aware that adding "hacklee/laravel5-php-redis": "dev-master" to composer.json works, but would prefer composer require to work as well as have versioning.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.