PHPackages                             arefshojaei/redis - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. arefshojaei/redis

ActiveLibrary[Database &amp; ORM](/categories/database)

arefshojaei/redis
=================

A memory database with key &amp; value

1.0.0(2w ago)03MITPHPPHP ^8.1

Since Jun 16Pushed 2w ago1 watchersCompare

[ Source](https://github.com/ArefShojaei/Redis)[ Packagist](https://packagist.org/packages/arefshojaei/redis)[ RSS](/packages/arefshojaei-redis/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

 🚀 Redis - PHP In-Memory Key-Value Database
============================================

[](#-----redis---php-in-memory-key-value-database)

 A lightweight Redis-inspired in-memory database built with PHP. Store, manage, and explore your data using a powerful CLI interface or a live web dashboard.

[![Redis](https://private-user-images.githubusercontent.com/134844185/593519338-b20fbb5e-fc16-482a-934a-82e41e9cd98b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2NzIyNDAsIm5iZiI6MTc4MjY3MTk0MCwicGF0aCI6Ii8xMzQ4NDQxODUvNTkzNTE5MzM4LWIyMGZiYjVlLWZjMTYtNDgyYS05MzRhLTgyZTQxZTljZDk4Yi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDYyOFQxODM5MDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05NTIxZTYzYjA4OGMwOTI5MjI1M2NkNDYwMTJhMWQzMzUxNTI0NzMxNTljYTE5ZGNhMzhhODkzOTE2ODQwMWE3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.Kh2yAM_0xH1mVO3diEypExIY-XuP7yokKNXPbBvz3ho)](https://private-user-images.githubusercontent.com/134844185/593519338-b20fbb5e-fc16-482a-934a-82e41e9cd98b.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2NzIyNDAsIm5iZiI6MTc4MjY3MTk0MCwicGF0aCI6Ii8xMzQ4NDQxODUvNTkzNTE5MzM4LWIyMGZiYjVlLWZjMTYtNDgyYS05MzRhLTgyZTQxZTljZDk4Yi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDYyOFQxODM5MDBaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05NTIxZTYzYjA4OGMwOTI5MjI1M2NkNDYwMTJhMWQzMzUxNTI0NzMxNTljYTE5ZGNhMzhhODkzOTE2ODQwMWE3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9aW1hZ2UlMkZwbmcifQ.Kh2yAM_0xH1mVO3diEypExIY-XuP7yokKNXPbBvz3ho)---

✨ Features
----------

[](#-features)

- 🔑 **Key-Value Storage** - Fast in-memory data management
- 💻 **Interactive CLI** - Manage your database through terminal commands
- 🌐 **Live Web Server** - Explore your data from a browser interface
- 📝 **String Operations** - Set, get, append, and manipulate text data
- 🔢 **Number Operations** - Increment and decrement numeric values
- 🗂️ **Hash Support** - Store structured objects using key-value pairs
- 📚 **List Support** - Manage ordered collections of values
- ⏱️ **Expiration System** - Set TTL for temporary data
- ⚡ **Fast &amp; Lightweight** - Built entirely with pure PHP

---

📥 Installation
==============

[](#-installation)

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Composer

---

Install with Composer
---------------------

[](#install-with-composer)

```
composer require arefshojaei/redis
```

---

Clone from GitHub
-----------------

[](#clone-from-github)

```
git clone https://github.com/ArefShojaei/Redis.git
cd Redis
```

---

🚀 Getting Started
=================

[](#-getting-started)

Redis can be used in two different modes.

1. Interactive CLI Mode
-----------------------

[](#1-interactive-cli-mode)

Run the database shell:

```
php bin/redis-cli
```

Or make it executable:

```
chmod +x ./bin/redis-cli
./bin/redis-cli
```

---

2. Web Dashboard Mode
---------------------

[](#2-web-dashboard-mode)

Start the live server:

```
php bin/redis-server
```

Or:

```
chmod +x ./bin/redis-server
./bin/redis-server
```

Then open your browser:

```
http://localhost:8000
```

---

📚 Data Types &amp; Commands
===========================

[](#-data-types--commands)

🔤 String Commands
-----------------

[](#-string-commands)

Set and get values:

```
set username Robert

get username
```

Set and return old value:

```
getSet username Kevin
```

Multiple values:

```
mset name=John age=25 country=USA
```

Append text:

```
append message World
```

Expiration:

```
setex token 3600 secret-key

ttl token
```

Delete:

```
del username
unlink user1 user2 user3
```

---

🔢 Number Commands
-----------------

[](#-number-commands)

Increase and decrease numbers:

```
set counter 10

incr counter
decr counter
```

Custom increment:

```
incrBy counter 5

decrBy counter 2
```

---

🗂 Hash Commands
---------------

[](#-hash-commands)

Create object-like data:

```
hset user name Robert

hset user age 25
```

Multiple fields:

```
hmset user name:Robert age:25 role:admin
```

Get data:

```
hget user name

hgetall user
```

Other operations:

```
hkeys user
hvals user
hlen user
hexists user age
```

---

📋 List Commands
---------------

[](#-list-commands)

Push values:

```
lpush tasks "Build Redis"

rpush tasks "Write Documentation"
```

Read data:

```
lrange tasks 0 10

llen tasks
```

Remove items:

```
lpop tasks

rpop tasks
```

---

🗄 Database Commands
-------------------

[](#-database-commands)

Show all stored data:

```
dump
```

List all keys:

```
keys
```

Remove all data:

```
flushdb
```

---

🔚 Session Commands
------------------

[](#-session-commands)

Exit the CLI:

```
quit
```

Check connection:

```
ping
```

---

💡 Example Workflow
==================

[](#-example-workflow)

Create a simple user record:

```
hset user:1 name Robert

hset user:1 email robert@example.com

hset user:1 role admin
```

Retrieve the data:

```
hgetall user:1
```

---

🔥 Why This Project?
===================

[](#-why-this-project)

This project is useful for learning:

- Database engine concepts
- Key-value storage design
- Command parsing
- CLI application development
- Memory management
- Data structures implementation in PHP

It is a great educational project for understanding how systems like Redis work internally.

---

🤝 Contributing
==============

[](#-contributing)

Contributions are welcome.

1. Fork the repository
2. Create a feature branch

```
git checkout -b feature/amazing-feature
```

3. Commit your changes:

```
git commit -m "Add amazing feature"
```

4. Push your branch:

```
git push origin feature/amazing-feature
```

5. Open a Pull Request

---

👨‍💻 Author
==========

[](#‍-author)

**Aref Shojaei**

- 📧 Email:
- 🐙 GitHub: [@ArefShojaei](https://github.com/ArefShojaei)
- 📦 Packagist: [arefshojaei/redis](https://packagist.org/packages/arefshojaei/redis)

---

⭐ Show Your Support
===================

[](#-show-your-support)

If this project helps you learn database internals or PHP system development, consider giving it a Star ⭐ on GitHub.

Your support motivates future improvements.

###  Health Score

39

↑

LowBetter than 84% of packages

Maintenance96

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

17d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab587c1a6f8067452db012ede97d8f6c2b7362c4442ddc95d798d81e8922dc67?d=identicon)[ArefShojaei](/maintainers/ArefShojaei)

---

Top Contributors

[![ArefShojaei](https://avatars.githubusercontent.com/u/134844185?v=4)](https://github.com/ArefShojaei "ArefShojaei (31 commits)")

---

Tags

cachingdatabasekeyvalue-dblibrarymemoryphpredissessionstoreclidatabaseredismemorynosqlcommanddashboard

### Embed Badge

![Health badge](/badges/arefshojaei-redis/health.svg)

```
[![Health](https://phpackages.com/badges/arefshojaei-redis/health.svg)](https://phpackages.com/packages/arefshojaei-redis)
```

###  Alternatives

[mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

25149.5k2](/packages/mysql-workbench-schema-exporter-doctrine2-exporter)[rediscluster/rediscluster

a php interface to a Cluster of Redis key-value store

271.3k](/packages/rediscluster-rediscluster)[cubettech/lacassa

Cassandra based query builder for laravel.

358.6k](/packages/cubettech-lacassa)[hzhihua/yii2-dump

Generate the schema from an existing database

1829.6k1](/packages/hzhihua-yii2-dump)[elimuswift/db-exporter

Export your database quickly and easily as a Laravel Migration and all the data as a Seeder class.

364.7k](/packages/elimuswift-db-exporter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
