https://github.com/initphp/redis
PHP Redis Management Library
https://github.com/initphp/redis
Last synced: about 1 year ago
JSON representation
PHP Redis Management Library
- Host: GitHub
- URL: https://github.com/initphp/redis
- Owner: InitPHP
- License: mit
- Created: 2022-10-31T06:02:59.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-05T06:22:06.000Z (over 3 years ago)
- Last Synced: 2025-01-26T03:13:44.150Z (about 1 year ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## InitPHP Redis Management
This library was born to facilitate and customize the use of getter and setter of PHP and Redis.
## Requirements
- PHP 7.4 or later
- PHP Redis Extension
## Installation
```
composer require initphp/redis
```
## Usage
```php
require_once "vendor/autoload.php";
use \InitPHP\Redis\Redis;
// Provide your connection information;
$redis = new Redis([
'prefix' => 'i_',
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'database' => 0,
]);
// Use Setter and Getter;
$redis->set('name', 'muhammet');
if($redis->has('name')){
echo $redis->get('name'); // "muhammet"
}
/**
* or tell the get method what it will
* do if it can't find it,
* or a default value it will return;
*/
echo $redis->get('username', 'Undefined'); // "Undefined"
echo $redis->get('surname', function () use ($redis) {
$value = 'ŞAFAK';
$redis->set('surname', $value);
return $value;
}); // "ŞAFAK"
```
## Credits
- [Muhammet ŞAFAK](https://www.muhammetsafak.com.tr) <>
## License
Copyright © 2022 [MIT License](./LICENSE)