PHPackages                             schpill/redissql - 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. schpill/redissql

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

schpill/redissql
================

Redis ORM abstraction for Laravel Framework

02PHP

Since Mar 15Pushed 2y agoCompare

[ Source](https://github.com/schpill/redissql)[ Packagist](https://packagist.org/packages/schpill/redissql)[ RSS](/packages/schpill-redissql/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Redis ORM abstraction for Laravel Framework
===========================================

[](#redis-orm-abstraction-for-laravel-framework)

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

[](#installation)

```
composer require schpill/redissql
```

Add service provider to your config/app.php file:

```
'providers' => [
    ...
    Morbihanet\RedisSQL\RedisSQLServiceProvider::class,
    ...
]
```

No need to create migrations nor models

Some examples
-------------

[](#some-examples)

```
use Morbihanet\RedisSQL\RedisSQL;

$bookModel = RedisSQL::forTable('book');
$authorModel = RedisSQL::forTable('author');

// create
$author = $authorModel->create([
    'name' => 'John Doe'
]);

// firstOrCreate
$bookModel->firstOrCreate([
    'title' => 'My Book',
    'author_id' => $author->id,
    'year' => 2020,
    'price' => 10.99
]);

$first = $bookModel->first();
$price = $first->price;
// or
$price = $first['price'];
// or
$price = $first->>getPrice();

$first->price = 12.99;
// or
$first['price'] = 12.99;
// or
$first->setPrice(12.99);

$first->save();

// relationships
$authorFirst = $first->author;
$books = $authorFirst->books;

// queries
$books = $bookModel->where('year', '>', 2010)->where('price', '
