{"id":36739816,"url":"https://github.com/angyvolin/predis-commands","last_synced_at":"2026-01-12T12:27:48.434Z","repository":{"id":62485972,"uuid":"89868105","full_name":"angyvolin/predis-commands","owner":"angyvolin","description":"Adds some useful commands to Predis. ","archived":false,"fork":false,"pushed_at":"2017-05-01T13:57:27.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-29T11:35:57.759Z","etag":null,"topics":["lua","predis","redis","redis-lua","redis-lua-script","zpop","zrpop"],"latest_commit_sha":null,"homepage":null,"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/angyvolin.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}},"created_at":"2017-04-30T18:09:24.000Z","updated_at":"2020-03-11T15:08:11.000Z","dependencies_parsed_at":"2022-11-02T10:00:59.874Z","dependency_job_id":null,"html_url":"https://github.com/angyvolin/predis-commands","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/angyvolin/predis-commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angyvolin%2Fpredis-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angyvolin%2Fpredis-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angyvolin%2Fpredis-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angyvolin%2Fpredis-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/angyvolin","download_url":"https://codeload.github.com/angyvolin/predis-commands/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/angyvolin%2Fpredis-commands/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["lua","predis","redis","redis-lua","redis-lua-script","zpop","zrpop"],"created_at":"2026-01-12T12:27:48.348Z","updated_at":"2026-01-12T12:27:48.429Z","avatar_url":"https://github.com/angyvolin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# predis-commands\n\nAdds some [Lua][4]-based atomic commands to [Predis][3]. \n\n\n## Motivation\n\nAny individual Redis command is always atomic because Redis is single threaded. In some cases you may want to run \n several Redis commands atomically. \n\nThere are two common ways to achieve this:\n - [Redis transactions][1]. It utilizes `MULTI`/`EXEC` Redis commands to run some commands in sequence \n   It also uses `WATCH`/`DISCARD` Redis commands for `CAS` optimistic concurrency.\n - [Redis scripts][2]. This one is transactional by definition: Redis uses the\nsame Lua interpreter to run all the commands and guarantees that no other script or Redis command will be executed \nwhile a script is being executed.\n\nThis project uses Lua Scripting approach as it's usually both simpler and faster. \n\n\n## Installation\n\n    composer require angyvolin/predis-commands\n\n\n## What's included?\n\nAs of now, the `predis-commands` project extends Predis with following commands:\n\n    ZPOP - Removes and returns the top value in a zset, with its score.\n    ZRPOP - Removes and returns the bottom value in a zset, with its score.\n\n\n## How to use predis-commands ...\n\n### ... in plain PHP\n\nCode snippet below demonstrates how to use `predis-commands` regardless of any framework \n\n```php\n\u003c?php\n\nrequire __DIR__.'/../vendor/autoload.php';\n\nuse Angyvolin\\Predis\\Command;\n\n$client = new Predis\\Client();\n$client-\u003egetProfile()-\u003edefineCommand('zpop', Command\\ZSetPop::class);\n$client-\u003egetProfile()-\u003edefineCommand('zrpop', Command\\ZSetReversePop::class);\n```\n\n### ... in Silex application\nCode snippet below demonstrates integration with Silex application \n\n```php\n\u003c?php\n\nuse Pimple\\Container;\nuse Pimple\\ServiceProviderInterface;\nuse Angyvolin\\Predis\\Command;\n\nclass PredisCommandsServiceProvider implements ServiceProviderInterface\n{\n    public function register(Container $app)\n    {\n        $app-\u003eextend('redis', function ($redis) {\n            /* @var \\Predis\\Client $redis */\n            $redis-\u003egetProfile()-\u003edefineCommand('zpop', Command\\ZSetPop::class);\n            $redis-\u003egetProfile()-\u003edefineCommand('zrpop', Command\\ZSetReversePop::class);\n        \n            return $redis;\n        });\n    }\n}\n```\n\n\n## Tests:\n\nTu run tests execute following command in a root directory of the predis-commands project:\n\n    phpunit\n\n\n## License\n\n[MIT License](LICENSE.md)\n\n\n[1]: https://redis.io/topics/transactions\n[2]: https://redis.io/commands/eval\n[3]: https://github.com/nrk/predis\n[4]: https://www.lua.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangyvolin%2Fpredis-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fangyvolin%2Fpredis-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fangyvolin%2Fpredis-commands/lists"}