Skip to content

Commit 515e130

Browse files
committed
feat(redis-contracts): add RedisClientInterface with unified KV contract (get/set/del/keys)
Introduced RedisClientInterface under Maatify\Common\Contracts\Redis: - Supports phpredis, Predis, and FakeRedisAdapter - Defines minimal key-value surface: get(), set(), del(), keys() - Ensures unified Redis behavior across adapters, fakes, and repository layers Documentation: - Added PHPDoc and examples inside interface - Updated header metadata and @SInCE tag (2025-11-26) Version: - Bumped library version to v1.0.9 (new public contract introduced)
1 parent 6ca35f7 commit 515e130

13 files changed

Lines changed: 921 additions & 20 deletions

CHANGELOG.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,90 @@ This project follows [Semantic Versioning](https://semver.org/).
55

66
---
77

8+
## **[1.0.9] – 2025-11-26**
9+
10+
### 🔌 **RedisClientInterface — Unified Redis Key/Value Contract**
11+
12+
This release introduces a **minimal, driver-agnostic Redis client interface** shared across:
13+
14+
* phpredis (Redis extension)
15+
* Predis (pure PHP)
16+
* FakeRedisConnection (test environment)
17+
18+
The goal is to establish a **consistent KV API layer** used by all Maatify libraries.
19+
20+
---
21+
22+
### 🧩 **Added**
23+
24+
#### `RedisClientInterface`
25+
26+
File location:
27+
28+
```
29+
src/Contracts/Redis/RedisClientInterface.php
30+
```
31+
32+
Standardized KV operations:
33+
34+
* `get(string $key): string|false|null`
35+
* `set(string $key, string $value): bool`
36+
* `del(string ...$keys): int`
37+
* `keys(string $pattern): array`
38+
39+
Designed for compatibility with:
40+
41+
* Redis (phpredis)
42+
* Predis\Client
43+
* internal FakeRedisConnection (used in maatify/data-fakes & lock tests)
44+
45+
---
46+
47+
### 🛠 **Changed**
48+
49+
* Updated `README.md` & `README.full.md` with new Redis Client documentation.
50+
* Updated `roadmap.json` (added Phase 17).
51+
* Updated version file (`VERSION → 1.0.9`).
52+
* Added new phase documentation:
53+
`/docs/phases/README.phase17.md`.
54+
55+
---
56+
57+
### 🧪 **Tests**
58+
59+
* Verified compatibility with FakeRedisConnection.
60+
* Mock-based signature testing for Predis + phpredis equivalents.
61+
* No breaking changes to Locking System (RedisLockManager/HybirdLockManager remain fully compatible).
62+
63+
---
64+
65+
### 📘 **Documentation**
66+
67+
* Added new Redis Contract section under “Core Modules”.
68+
* Included examples for `get`, `set`, `del`, `keys`.
69+
* Updated Phase Summary Table to include Phase 17.
70+
71+
---
72+
73+
### **Notes**
74+
75+
* No breaking changes.
76+
* Fully backward compatible.
77+
* Required for future caching decorators in `maatify/data-repository`.
78+
* Unifies Redis behavior across the entire Maatify ecosystem.
79+
80+
---
81+
82+
### 🧾 **Changelog Snapshot**
83+
84+
**v1.0.9 — 2025-11-26**
85+
86+
* Added: RedisClientInterface (Phase 17)
87+
* Updated: README files, roadmap, VERSION, phase docs
88+
* Ensured compatibility with FakeRedis, Predis, and phpredis
89+
90+
---
91+
892
## **[1.0.8] – 2025-11-22**
993

1094
### 🧩 **RepositoryInterface Foundation — Unified CRUD Contract**

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 🤝 Contributing to maatify/common
22

3+
[![Maatify Repository](https://img.shields.io/badge/Maatify-Repository-blue?style=for-the-badge)](README.md)
4+
[![Maatify Ecosystem](https://img.shields.io/badge/Maatify-Ecosystem-9C27B0?style=for-the-badge)](https://github.com/Maatify)
5+
36
Thank you for your interest in contributing to **maatify/common** — the core foundational library powering the entire Maatify ecosystem.
47
Your contributions help improve code quality, reliability, and scalability across all Maatify projects.
58

README.md

Lines changed: 142 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,33 @@
44

55
# 📦 maatify/common
66

7-
[![Version](https://img.shields.io/packagist/v/maatify/common?label=Version&color=4C1)](https://packagist.org/packages/maatify/common)
8-
[![PHP](https://img.shields.io/packagist/php-v/maatify/common?label=PHP&color=777BB3)](https://packagist.org/packages/maatify/common)
9-
[![Build](https://github.com/Maatify/common/actions/workflows/ci.yml/badge.svg?label=Build&color=brightgreen)](https://github.com/Maatify/common/actions/workflows/ci.yml)
10-
[![Monthly Downloads](https://img.shields.io/packagist/dm/maatify/common?label=Monthly%20Downloads&color=00A8E8)](https://packagist.org/packages/maatify/common)
11-
[![Total Downloads](https://img.shields.io/packagist/dt/maatify/common?label=Total%20Downloads&color=2AA)](https://packagist.org/packages/maatify/common)
12-
[![Stars](https://img.shields.io/github/stars/Maatify/common?label=Stars&color=FFD43B)](https://github.com/Maatify/common/stargazers)
13-
[![License](https://img.shields.io/github/license/Maatify/common?label=License&color=blueviolet)](LICENSE)
14-
[![Status](https://img.shields.io/badge/Status-Stable-success?style=flat-square)]()
15-
[![Code Quality](https://img.shields.io/codefactor/grade/github/Maatify/common/main)](https://www.codefactor.io/repository/github/Maatify/common)
7+
<!-- 1) Package Info -->
8+
[![Version](https://img.shields.io/packagist/v/maatify/common?label=Version&color=4C1&style=flat-square)](https://packagist.org/packages/maatify/common)
9+
[![PHP](https://img.shields.io/packagist/php-v/maatify/common?label=PHP&color=777BB3&style=flat-square)](https://packagist.org/packages/maatify/common)
10+
[![License](https://img.shields.io/github/license/Maatify/common?label=License&color=blueviolet&style=flat-square)](LICENSE)
11+
[![Status](https://img.shields.io/badge/Status-Stable-success?style=flat-square)](CHANGELOG.md)
12+
13+
<!-- 2) CI / QA -->
14+
[![Build](https://github.com/Maatify/common/actions/workflows/ci.yml/badge.svg?style=flat-square)](https://github.com/Maatify/common/actions/workflows/ci.yml)
15+
[![PHPStan](https://img.shields.io/badge/PHPStan-Level%206-4E8CAE?style=flat-square)](https://phpstan.org/)
16+
[![Code Quality](https://img.shields.io/codefactor/grade/github/Maatify/common/main?color=brightgreen&style=flat-square)](https://www.codefactor.io/repository/github/Maatify/common)
17+
18+
[//]: # ([![Coverage]&#40;https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Maatify/common/badges/coverage.json&style=flat-square&#41;]&#40;&#41;)
19+
20+
<!-- 3) Popularity -->
21+
[![Monthly Downloads](https://img.shields.io/packagist/dm/maatify/common?label=Monthly%20Downloads&color=00A8E8&style=flat-square)](https://packagist.org/packages/maatify/common)
22+
[![Total Downloads](https://img.shields.io/packagist/dt/maatify/common?label=Total%20Downloads&color=2AA9E0&style=flat-square)](https://packagist.org/packages/maatify/common)
23+
[![Stars](https://img.shields.io/github/stars/Maatify/common?label=Stars&color=FFD43B&cacheSeconds=3600&style=flat-square)](https://github.com/Maatify/common/stargazers)
24+
25+
<!-- 4) Documentation -->
26+
[![Changelog](https://img.shields.io/badge/Changelog-View-blue?style=flat-square)](CHANGELOG.md)
27+
[![Security](https://img.shields.io/badge/Security-Policy-important?style=flat-square)](SECURITY.md)
28+
[![Full Docs](https://img.shields.io/badge/Docs-Full%20Guide-0A66C2?style=flat-square)](docs/README.full.md)
29+
[![Contributing](https://img.shields.io/badge/Contributing-Guide-0A9396?style=flat-square)](CONTRIBUTING.md)
1630

1731
---
1832

19-
## 🏁 Stable Release v1.0.8Repository Layer Foundation
33+
## 🏁 Stable Release v1.0.9Redis Client Contract Added
2034

2135
The core foundational library of the Maatify.dev ecosystem providing standardized DTOs, validation, sanitization,
2236
date/time, locking, text utilities, and now **a unified RepositoryInterface** powering all Maatify data layers.
@@ -30,8 +44,8 @@ date/time, locking, text utilities, and now **a unified RepositoryInterface** po
3044

3145
| Key | Value |
3246
|-----------------|---------------------|
33-
| Version | **1.0.8 Stable** |
34-
| Release Date | 2025-11-22 |
47+
| Version | **1.0.9 Stable** |
48+
| Release Date | 2025-11-26 |
3549
| PHP Requirement | ≥ 8.4 |
3650
| License | MIT |
3751
| Coverage | 98 % |
@@ -50,9 +64,46 @@ shared across all **Maatify** ecosystem packages such as:
5064
* `maatify/psr-logger`
5165
* `maatify/bootstrap`
5266

67+
> **New in v1.0.9:**
68+
> A unified **RedisClientInterface** providing a minimal KV API compatible with phpredis, Predis, and FakeRedisConnection.
69+
5370
> **New in v1.0.8:**
5471
> A unified **RepositoryInterface** that standardizes CRUD operations across MySQL, Mongo, Redis, Predis, and DBAL repositories.
5572
73+
---
74+
## 🚀 What’s New in v1.0.9 (Phase 17)
75+
76+
### ⭐ Redis Client Contract Added
77+
78+
Phase 17 introduces the **RedisClientInterface**, a minimal and unified Redis API surface shared across
79+
`phpredis`, `Predis`, and the in-memory `FakeRedisConnection`.
80+
81+
### ✔ Added
82+
83+
* **`RedisClientInterface`**
84+
85+
* `get()`
86+
* `set()`
87+
* `del()`
88+
* `keys()`
89+
90+
### ✔ Updated
91+
92+
* README.full.md
93+
* API Map
94+
* roadmap.json
95+
* CHANGELOG → **v1.0.9**
96+
* VERSION → **1.0.9**
97+
* Added `/docs/phases/README.phase17.md`
98+
99+
### ✔ Compatibility
100+
101+
* Fully driver-agnostic (phpredis / predis / fakes)
102+
* Required for next updates in:
103+
* maatify/data-fakes (FakeRedis → full KV compatibility)
104+
* maatify/data-adapters (RedisAdapter)
105+
* maatify/data-repository (cache decorators)
106+
56107
---
57108

58109
## 🚀 What’s New in v1.0.8 (Phase 16)
@@ -93,12 +144,12 @@ Phase 16 introduces a standardized repository contract used across the entire Ma
93144

94145
| File | Description |
95146
|----------------------------------|----------------------------------------|
96-
| `/docs/README.full.md` | Full documentation (Phases 1–16) |
147+
| `/docs/README.full.md` | Full documentation (Phases 1–17) |
97148
| `/docs/enums.md` | Enums & constants reference |
98149
| `/docs/phases/README.phase16.md` | Phase 16 — Repository Layer Foundation |
99-
| `CHANGELOG.md` | Version history (updated to 1.0.8) |
150+
| `CHANGELOG.md` | Version history (updated to 1.0.9) |
100151
| `CONTRIBUTING.md` | Contribution guidelines |
101-
| `VERSION` | Current version → **1.0.8** |
152+
| `VERSION` | Current version → **1.0.9** |
102153

103154
---
104155

@@ -128,6 +179,11 @@ Phase 16 introduces a standardized repository contract used across the entire Ma
128179
* ⚙️ **Enums & Constants Standardization**`TextDirectionEnum`, `MessageTypeEnum`, `ErrorCodeEnum`, `PlatformEnum`, `AppEnvironmentEnum`, `CommonPaths`, `CommonLimits`, `CommonHeaders`, `Defaults`, `EnumHelper`
129180
Centralized enum and constant definitions ensuring consistent standards, reusable helpers, and unified configuration across all Maatify libraries.
130181

182+
* 🔌 **Redis Client Contract**`RedisClientInterface`
183+
Minimal key–value Redis abstraction compatible with:
184+
* phpredis
185+
* Predis
186+
* FakeRedisConnection
131187
---
132188

133189
## ⚙️ Installation
@@ -755,6 +811,40 @@ echo Defaults::DEFAULT_TIMEZONE; // 'Africa/Cairo'
755811

756812
---
757813

814+
## 🔌 Redis Client Interface (Phase 17)
815+
816+
A unified minimal KV API that works across:
817+
818+
* phpredis
819+
* Predis
820+
* FakeRedisConnection (tests)
821+
822+
### 🔹 Example — Get & Set
823+
824+
```php
825+
use Maatify\Common\Contracts\Redis\RedisClientInterface;
826+
827+
/** @var RedisClientInterface $redis */
828+
$redis->set('token', 'abc123');
829+
830+
echo $redis->get('token'); // abc123
831+
````
832+
833+
### 🔹 Example — Delete Many
834+
835+
```php
836+
$deleted = $redis->del('a', 'b', 'c');
837+
// returns number of deleted keys
838+
```
839+
840+
### 🔹 Example — Pattern Keys
841+
842+
```php
843+
print_r($redis->keys('user:*'));
844+
```
845+
846+
---
847+
758848
### 🗂 Directory (Enums & Constants)
759849

760850
```
@@ -959,6 +1049,43 @@ src/
9591049
9601050
---
9611051

1052+
# 🧾 **Release Verification — v1.0.9 (Phase 17)**
1053+
1054+
### **Redis Client Contract**
1055+
1056+
## **v1.0.9 — Unified Redis Client API**
1057+
1058+
### 🔧 Added
1059+
1060+
* `src/Contracts/Redis/RedisClientInterface.php`
1061+
* Unified driver-agnostic Redis interface:
1062+
* `get`
1063+
* `set`
1064+
* `del`
1065+
* `keys`
1066+
1067+
### ✔ Updated
1068+
1069+
* `README.md`
1070+
* `README.full.md`
1071+
* `CHANGELOG.md` → v1.0.9
1072+
* `VERSION`**1.0.9**
1073+
* Roadmap (phase17)
1074+
* Full phase doc → `docs/phases/README.phase17.md`
1075+
1076+
### 🧪 Tests
1077+
1078+
* Verified compatibility with FakeRedisConnection
1079+
* Signature-safe with Predis/PhpRedis mocks
1080+
* No breaking changes
1081+
1082+
## 🧩 Final Status
1083+
1084+
**Phase 17 is completed successfully.**
1085+
Unified RedisClientInterface is now part of maatify/common and ready for integration with the ecosystem.
1086+
1087+
---
1088+
9621089

9631090
# 🧾 **Release Verification — v1.0.8 (Phase 16)**
9641091

SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# 🛡️ Security Policy
22

3+
[![Maatify Repository](https://img.shields.io/badge/Maatify-Repository-blue?style=for-the-badge)](README.md)
4+
[![Maatify Ecosystem](https://img.shields.io/badge/Maatify-Ecosystem-9C27B0?style=for-the-badge)](https://github.com/Maatify)
5+
6+
37
This document describes the security procedures and policies for **maatify/common**.
48
We take the security of our ecosystem seriously, and we appreciate any responsible disclosure that helps keep our libraries, users, and integrations safe.
59

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.8
1+
1.0.9

0 commit comments

Comments
 (0)