{"id":27951003,"url":"https://github.com/matheusjohannaraujo/simple-redis","last_synced_at":"2026-02-22T16:14:15.840Z","repository":{"id":72601853,"uuid":"604823542","full_name":"matheusjohannaraujo/simple-redis","owner":"matheusjohannaraujo","description":"Simple Redis is a PHP class that provides a practical and reusable abstraction for working with Redis. It allows you to easily create connections and perform common operations such as set, get, del, list, pub, sub and many others, without worrying about the underlying configuration complexity.","archived":false,"fork":false,"pushed_at":"2025-04-21T09:43:02.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T16:16:30.636Z","etag":null,"topics":["docker","key-value","list","php","pubsub","redis","redis-pubsub","redis-queue","redis-server"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matheusjohannaraujo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-21T21:36:45.000Z","updated_at":"2025-04-21T09:43:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"914067db-7700-414b-83a4-7495fc805b0a","html_url":"https://github.com/matheusjohannaraujo/simple-redis","commit_stats":null,"previous_names":["matheusjohannaraujo/simple-redis"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusjohannaraujo%2Fsimple-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusjohannaraujo%2Fsimple-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusjohannaraujo%2Fsimple-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusjohannaraujo%2Fsimple-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matheusjohannaraujo","download_url":"https://codeload.github.com/matheusjohannaraujo/simple-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252912934,"owners_count":21824066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","key-value","list","php","pubsub","redis","redis-pubsub","redis-queue","redis-server"],"created_at":"2025-05-07T16:16:35.292Z","updated_at":"2026-02-22T16:14:10.814Z","avatar_url":"https://github.com/matheusjohannaraujo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Simple Redis](https://github.com/matheusjohannaraujo/simple-redis)\n\n**SimpleRedis** is a PHP class that offers a practical and reusable abstraction for working with Redis. It allows you to easily establish connections and perform common operations, as outlined in the features section — all without the need to worry about the underlying configuration complexity.\n\n## 📦 Installation\n\nYou can install the library via [Packagist/Composer](https://packagist.org/packages/mjohann/simple-redis):\n\n```bash\ncomposer require mjohann/simple-redis\n```\n\n## ⚙️ Requirements\n\n- PHP 8.0 or higher\n\n## 🚀 Features\n\n- SimpleRedis uses [`predis/predis`](https://packagist.org/packages/predis/predis) as a dependency\n- Supported:\n  - `set`\n  - `get`\n  - `del`\n  - `list`\n  - `pub`\n  - `sub`\n\n## 🧪 Usage Example\n\n```php\n\u003c?php\n\nrequire_once \"vendor/autoload.php\";\n\nuse MJohann\\Packlib\\SimpleRedis;\n\n// Create and configure a Redis connection\n$redis = new SimpleRedis();\n$redis-\u003eopen();\n\n// SET: Store the key \"key\" with the value \"value\" and a TTL (Time To Live) of 60 seconds\necho \"Set: \";\nvar_dump($redis-\u003eset(\"key\", \"value\", 60));\necho PHP_EOL, PHP_EOL;\n\n// GET: Retrieve the value associated with the key \"key\"\necho \"Get: \";\nvar_dump($redis-\u003eget(\"key\"));\necho PHP_EOL, PHP_EOL;\n\n// Wait 10 seconds before deleting the key\nsleep(10);\n\n// DEL: Delete the key \"key\" from Redis\necho \"Del: \";\nvar_dump($redis-\u003edel(\"key\"));\necho PHP_EOL, PHP_EOL;\n\n// Define the key for the RPUSH list\n$keyListRPUSH = \"list:names_RPUSH\";\n\n// RPUSH: Add elements to the end (right) of the list\necho \"List RPUSH: \";\nvar_dump($redis-\u003elistPush($keyListRPUSH, \"Matheus\", \"r\"));\necho PHP_EOL, PHP_EOL;\n\necho \"List RPUSH: \";\nvar_dump($redis-\u003elistPush($keyListRPUSH, \"Johann\", \"r\"));\necho PHP_EOL, PHP_EOL;\n\necho \"List RPUSH: \";\nvar_dump($redis-\u003elistPush($keyListRPUSH, \"Araújo\", \"r\"));\necho PHP_EOL, PHP_EOL;\n\n// Update the value at index 0 in the list\necho \"List set: \";\nvar_dump($redis-\u003elistSet($keyListRPUSH, 0, \"Matheus Johann\"));\necho PHP_EOL, PHP_EOL;\n\n// Wait 5 seconds\nsleep(5);\n\n// Remove the element \"Johann\" from the list\necho \"List remove: \";\nvar_dump($redis-\u003elistRemove($keyListRPUSH, \"Johann\"));\necho PHP_EOL;\n\n// Define the key for the LPUSH list\n$keyList = \"list:names_LPUSH\";\n\n// LPUSH: Add elements to the beginning (left) of the list\necho \"List LPUSH: \",\nvar_dump($redis-\u003elistPush($keyList, \"Matheus\"));\necho PHP_EOL, PHP_EOL;\n\necho \"List LPUSH: \",\nvar_dump($redis-\u003elistPush($keyList, \"Johann\"));\necho PHP_EOL, PHP_EOL;\n\necho \"List LPUSH: \",\nvar_dump($redis-\u003elistPush($keyList, \"Araújo\"));\necho PHP_EOL, PHP_EOL;\n\n// LLEN: Get the total number of elements in the list\necho \"List size: \";\nvar_dump($redis-\u003elistSize($keyList));\necho PHP_EOL, PHP_EOL;\n\n// LINDEX: Retrieve the element at index 0\necho \"List index [0]: \";\nvar_dump($redis-\u003elistIndex($keyList, 0));\necho PHP_EOL, PHP_EOL;\n\n// LRANGE: Retrieve all elements from the list\necho \"List all: \";\nvar_dump($redis-\u003elistAll($keyList));\necho PHP_EOL;\n\n// Wait 5 seconds\nsleep(5);\n\n// LPOP: Remove and print one element from the beginning of the list every 5 seconds\necho \"Popping list items...\" . PHP_EOL;\nwhile (($value = $redis-\u003elistPop($keyList)) !== null) {\n    var_dump($value);\n    echo PHP_EOL, PHP_EOL;\n    sleep(5);\n}\n\n// Delete the entire list\necho \"Del: \";\nvar_dump($redis-\u003edel($keyListRPUSH));\necho PHP_EOL, PHP_EOL;\n\n// Close the Redis connection\n$redis-\u003eclose();\n```\n\nFor more examples, see the [`example/`](example/) file in the repository.\n\n## 📁 Project Structure\n\n```\nsimple-redis/\n├── src/\n│   └── SimpleRedis.php\n│   └── Facades/\n│       └── SimpleRedis.php\n├── example/\n│   └── docker-compose.yml\n│   └── script.php\n│   └── sub.php\n│   └── pub.php\n├── composer.json\n├── .gitignore\n├── LICENSE\n└── README.md\n```\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.\n\n## 👨‍💻 Author\n\nDeveloped by [Matheus Johann Araújo](https://github.com/matheusjohannaraujo) – Pernambuco, Brazil.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusjohannaraujo%2Fsimple-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheusjohannaraujo%2Fsimple-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusjohannaraujo%2Fsimple-redis/lists"}