{"id":26849724,"url":"https://github.com/dominics/predisque","last_synced_at":"2025-03-30T21:39:34.025Z","repository":{"id":57076988,"uuid":"84073038","full_name":"dominics/predisque","owner":"dominics","description":"Disque client based on Predis","archived":false,"fork":false,"pushed_at":"2017-05-06T23:48:27.000Z","size":99,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-10T02:21:56.351Z","etag":null,"topics":["disque","php","predis"],"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/dominics.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-03-06T12:54:53.000Z","updated_at":"2017-04-23T14:03:42.000Z","dependencies_parsed_at":"2022-08-24T13:00:25.750Z","dependency_job_id":null,"html_url":"https://github.com/dominics/predisque","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominics%2Fpredisque","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominics%2Fpredisque/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominics%2Fpredisque/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dominics%2Fpredisque/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dominics","download_url":"https://codeload.github.com/dominics/predisque/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246385411,"owners_count":20768668,"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":["disque","php","predis"],"created_at":"2025-03-30T21:39:33.487Z","updated_at":"2025-03-30T21:39:34.001Z","avatar_url":"https://github.com/dominics.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Predisque\n\n[![Build Status](https://travis-ci.org/dominics/predisque.svg?branch=master)](https://travis-ci.org/dominics/predisque)\n\nA [Disque](https://github.com/antirez/disque) client for PHP 7.1+ based on (and depending on) Predis. `predis : redis :: predisque : disque`, yeah?\n\nThe library is made up of:\n\n * A set of commands (as in `Predis\\Command\\Command`) that you can use with Disque, and a server profile for Predis\n * A `Predisque\\Client` that's set up to use port 7711 and the Disque server profile by default\n * An aggregate connection (`Predisque\\Connection\\Aggregate\\DisqueCluster`) that handles talking to a Disque cluster as a whole\n   * Supports discovery via `HELLO`\n   * Supports retrying commands transparently if they fail with a `ConnectionException` (so we handle `-LEAVING` responses by swapping to another node)\n\nBecause Predisque is based on a feature-rich Predis core, we get things like pipelining and nice underlying Redis protocol\nsupport \"for free\". (A Disque client library should probably not contain its own native Redis protocol parser.)\n\nSupport for all Disque commands is implemented, including exotic ones like `DEBUG`, `MONITOR`, and `CLUSTER INFO`. See\n[TODO.md](TODO.md) for progress on reaching a stable API.\n\nNot yet stable for production use.\n\n## Usage\n\nThe PHP namespace is `\\Predisque`\n\nTo create a client, instantiate a `new \\Predisque\\Client(string|array $parameters = [], array $options = [])`.\n\nThe method signature is similar to a Predis client: the connection parameters (host, port, etc.) come first, and\ncan be given in array or DSN/URI string notation. Then a set of more general options comes after. So, all of the\nfollowing have the same result (a connection to a single Disque server):\n\n```php\n$client = new \\Predisque\\Client();\n$client = new \\Predisque\\Client('tcp://127.0.0.1:7711');\n$client = new \\Predisque\\Client([\n    'host' =\u003e '127.0.0.1',\n    'port' =\u003e 7711\n]);\n```\n\nConnecting to multiple servers is as easy as passing an array of node details:\n\n```php\n$client = new \\Predisque\\Client(['tcp://127.0.0.1:7711', 'tcp://127.0.0.1:7712', 'tcp://127.0.0.1:7713']);\n```\n\n### Connection Switching\n\nOnly one of these connections will be utilized at a time, but the others will be used if the connection to the first\nserver fails, or if it gives a `-LEAVING` response. Also, details from the cluster's `HELLO` response will be used to\nconnect to even further backup nodes (so make sure all nodes are accessible to every client).\n\nYou can control this behavior with the `discover` option:\n\n ```php\n $client = new \\Predisque\\Client('tcp://127.0.0.1:7711', ['discover' =\u003e false]);\n ```\n\nYou can also *disable* all Disque-specific connection niceties (and the aggregate connection in general), by passing the\n`'cluster' =\u003e false` option:\n\n ```php\n $client = new \\Predisque\\Client('tcp://127.0.0.1:7711', ['cluster' =\u003e false]);\n ```\n\n## Testing\n\n**Warning: the test suite uses the `DEBUG FLUSHALL` command. Do not run the tests against a Disque instance you care\nabout.** Running the tests will destroy all data on the disque instance they use. (You won't have the tests if\nyou're just using the client as a dist from composer.)\n\nTo execute the test suite, run e.g. `DISQUE_SERVER_PORT=7711 ./vendor/bin/phpunit` - the port must be specified, or the\nunhelpful default of 12345 will be used to prevent accidents.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominics%2Fpredisque","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdominics%2Fpredisque","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdominics%2Fpredisque/lists"}