Use Redis as a primary data store.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
CHANGELOG.md
LICENSE.md
README.md
composer.json
phpunit.xml

README.md

RedisModel

Latest Version on Packagist Software License Build Status Total Downloads

A Model accessor that makes using Redis as a primary data store easy.

Install

Via Composer

$ composer require Ryuske/RedisModel

Usage

/**
 * Available Methods:
 * get($id, $fields='all')
 *
 * searchBy($data, $fields='all');
 * searchByWildcard($data, $fields='all');
 * 
 * update($id)
 * save()
 *
 * delete($id)
 * delete()
 */

class Account extends Ryuske\Redis\Model
{
    /**
     * These are fields that are searchable.
     * The order of this list matters!
     * Add additional indexes to the bottom
     *
     * @var array
     */
    protected $indexes = [
        'id',
        'email'
    ];

    /**
     * These are additional, non-searchable indexes.
     * The order of this list doesn't matter.
     *
     * @var array
     */
    protected $fields = [
        'name',
        'password'
    ];
}

class MyController
{
    /**
     * @var Account
     */
    protected $account;

    public function __construct(Account $account)
    {
        $this->account = $account;
    }
    
    public function showAccount($id)
    {
        $account = $this->account->get($id);
        
        return view('account.show', [
            'account' => $account
        ]);
    }
}

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email kenyon.jh@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.