https://github.com/pardnchiu/php-redis
PD\Redis is a PHP Redis client wrapper built on Predis, offering simplified Redis operations with automatic connection management.
https://github.com/pardnchiu/php-redis
pardnchiu pardnio pardnltd php-composer php-library redis
Last synced: about 2 months ago
JSON representation
PD\Redis is a PHP Redis client wrapper built on Predis, offering simplified Redis operations with automatic connection management.
- Host: GitHub
- URL: https://github.com/pardnchiu/php-redis
- Owner: pardnchiu
- License: mit
- Created: 2025-02-02T20:27:25.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-02-03T08:29:28.000Z (3 months ago)
- Last Synced: 2025-03-02T23:05:19.194Z (2 months ago)
- Topics: pardnchiu, pardnio, pardnltd, php-composer, php-library, redis
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PD\Redis
> PD\Redis is a PHP Redis client wrapper built on Predis, offering simplified Redis operations with automatic connection management.



## Features
- Automatic connection management
- Environment-based configuration
- Persistent connection support
- Automatic database selection
- Built-in error handling
- Connection state monitoring
- Automatic cleanup on destruction## Key Capabilities
- Simple get/set operations with database selection
- Automatic connection retry mechanism
- Expiration time management
- Connection status checking
- Environment variables configuration
- Persistent connection support## Required Environment Variables
```SHELL
REDIS_HOST=localhost # Required: Redis server host
REDIS_PORT=6379 # Required: Redis server port
REDIS_PASSWORD=secret # Optional: Redis server password
```## How to Use
### Install
```SHELL
composer require pardnchiu/redis
``````PHP
// Initialize Redis client
$redis = new PD\Redis();// Set value with expiration
$redis->set(0, "user:123", "user_data", 3600); // db 0, expires in 1 hour// Get value
$data = $redis->get(0, "user:123"); // from db 0// Check connection status
if ($redis->isConnected()) {
// Redis is connected and ready
}
```## License
This source code project is licensed under the [MIT](https://github.com/pardnchiu/PHP-Redis/blob/main/LICENSE) license.
## Creator
邱敬幃 Pardn Chiu
***
©️ 2024 [邱敬幃 Pardn Chiu](https://pardn.io)