PHPackages                             nailfor/redis - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. nailfor/redis

ActiveLibrary[Database &amp; ORM](/categories/database)

nailfor/redis
=============

Eloquent like library for Redis

v0.1.7(1y ago)0655MITPHPPHP &gt;=7.1.0

Since Dec 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nailfor/redis)[ Packagist](https://packagist.org/packages/nailfor/redis)[ RSS](/packages/nailfor-redis/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (9)Used By (0)

PHP Redis client for Laravel
============================

[](#php-redis-client-for-laravel)

Redis client for Eloquent ORM

Features
--------

[](#features)

All models are inherited from Illuminate\\Database\\Eloquent\\Model so most methods work natively

### Model Supports

[](#model-supports)

MethodIs WorkingCURDYesCondition Selectyes(HASH)fillingYesLimitNot yetChunkingNot yetTransactionNot yetInsert a lot of dataNot yetDelete a lot of dataNot yetUpdate a lot of dataNot yetExpireYesRelationshipYes### Key Supports

[](#key-supports)

Model typeConstantHASHTYPE\_HASHSETTYPE\_SET### Key structure

[](#key-structure)

Sample key structure for a Redis model in Laravel:

`{config.redis.options.prefix}{model_table_name|class_name}:{primary_key}`

- model\_table\_name: The name of the current model table which set like 'protected $table = "name"'.
- primary\_key: The primary key of the model (id).

Example key:

`rdb_product:1`

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require nailfor/redis

```

or add

```
"nailfor/redis" : "*"
```

to the require section of your application's `composer.json` file.

Configure
---------

[](#configure)

Add config/app.php

```
    'providers' => [
        ...
        nailfor\Redis\RedisServiceProvider::class,
```

and config/database.php

```
    'connections' => [
        ...
        'redis' => [ //the name of connection in your models(default)
            'driver'    => 'redis',
        ],
```

Usage
-----

[](#usage)

### Models

[](#models)

```
├── DbProduct.php
├── RdbBrand.php
├── RdbProduct.php
└── User.php

```

DbProduct is a regular Eloquent model.

```
