ryuske / redismodel
Use Redis as a primary data store.
v0.5
2016-08-03 08:25 UTC
Requires
- php: >=5.6
- predis/predis: ^1.1
Requires (Dev)
- fzaninotto/faker: ~1.4
- illuminate/support: 5.2.*
- laravel/laravel: 5.2.*
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.0
- symfony/css-selector: 2.8.*|3.0.*
- symfony/dom-crawler: 2.8.*|3.0.*
This package is not auto-updated.
Last update: 2024-11-23 19:26:47 UTC
README
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.