{"id":28394966,"url":"https://github.com/ouqiang/etcd-php","last_synced_at":"2025-06-27T01:31:31.786Z","repository":{"id":57059092,"uuid":"94593507","full_name":"ouqiang/etcd-php","owner":"ouqiang","description":"PHP client for Etcd v3","archived":false,"fork":false,"pushed_at":"2022-11-03T13:31:40.000Z","size":15,"stargazers_count":71,"open_issues_count":6,"forks_count":38,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-01T06:31:55.965Z","etag":null,"topics":["etcd-client","etcd-php","etcdv3"],"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/ouqiang.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-06-17T01:40:24.000Z","updated_at":"2025-05-16T06:38:45.000Z","dependencies_parsed_at":"2022-08-24T14:53:26.230Z","dependency_job_id":null,"html_url":"https://github.com/ouqiang/etcd-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ouqiang/etcd-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouqiang%2Fetcd-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouqiang%2Fetcd-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouqiang%2Fetcd-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouqiang%2Fetcd-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ouqiang","download_url":"https://codeload.github.com/ouqiang/etcd-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ouqiang%2Fetcd-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172444,"owners_count":23270009,"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":["etcd-client","etcd-php","etcdv3"],"created_at":"2025-05-31T19:09:32.626Z","updated_at":"2025-06-27T01:31:31.776Z","avatar_url":"https://github.com/ouqiang.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# etcd-php\nPHP client for Etcd v3\n\n[![Build Status](https://travis-ci.org/ouqiang/etcd-php.png)](https://travis-ci.org/ouqiang/etcd-php)\n[![Latest Stable Version](https://poser.pugx.org/start-point/etcd-php/v/stable.png)](https://packagist.org/packages/start-point/etcd-php)\n[![Total Downloads](https://poser.pugx.org/start-point/etcd-php/downloads.png)](https://packagist.org/packages/ouqiang/etcd-php)\n[![License](https://poser.pugx.org/start-point/etcd-php/license.png)](https://packagist.org/packages/start-point/etcd-php)\n\n\n[documentation](https://github.com/ouqiang/etcd-php/wiki)\n\nRequirements\n------------\n* PHP5.5+\n* Composer\n\n\nInstallation\n------------\n```shell\ncomposer require start-point/etcd-php\n```\n\nUsage\n------------\n\n```php\n\u003c?php\nrequire 'vendor/autoload.php';\n$client = new \\Etcd\\Client('127.0.0.1:2379');\n\n/*********** kv ***********/\n// set value\n$client-\u003eput('redis', '127.0.0.1:6379');\n\n// set value and return previous value\n$client-\u003eput('redis', '127.0.0.1:6579', ['prev_kv' =\u003e true]);\n\n// set value with lease\n$client-\u003eput('redis', '127.0.0.1:6579', ['lease' =\u003e 7587822882194199413]);\n\n// get key value\n$client-\u003eget('redis');\n\n// get all keys\n$client-\u003egetAllKeys();\n\n// get keys with prefix\n$client-\u003egetKeysWithPrefix('/v3/service/user/');\n\n// delete key\n$client-\u003edel('redis');\n\n// compaction\n$client-\u003ecompaction(7);\n\n\n/************ lease *****************/\n\n$client-\u003egrant(3600);\n\n// grant with ID\n$client-\u003egrant(3600, 7587822882194199413);\n\n// revoke a lease\n$client-\u003erevoke(7587822882194199413);\n\n// keep the lease alive\n$client-\u003ekeepAlive(7587822882194199413);\n\n// retrieve lease information\n$client-\u003etimeToLive(7587822882194199413);\n\n\n/************ auth role user **************/\n\n// enable authentication\n$client-\u003eauthEnable();\n\n// disable authentication\n$client-\u003eauthDisable();\n\n// get auth token\n$client-\u003eauthenticate('user', 'password');\n\n// set auth token\n$client-\u003esetToken($token);\n\n// clear auth token\n$client-\u003eclearToken();\n\n// add a new role\n$client-\u003eaddRole('root');\n\n// get detailed role information\n$client-\u003egetRole('root');\n\n// delete a specified role\n$client-\u003edeleteRole('root');\n\n// get lists of all roles\n$client-\u003eroleList();\n\n// add a new user\n$client-\u003eaddUser('user', 'password');\n\n// get detailed user information\n$client-\u003egetUser('root');\n\n// delete a specified user\n$client-\u003edeleteUser('root');\n\n// get a list of all users.\n$client-\u003euserList();\n\n// change the password of a specified user\n$client-\u003echangeUserPassword('user', 'new password');\n\n// grant a role to a specified user\n$client-\u003egrantUserRole('user', 'role');\n\n// revoke a role of specified user\n$client-\u003erevokeUserRole('user', 'role');\n\n// grant a permission of a specified key or range to a specified role\n$client-\u003egrantRolePermission('admin', \\Etcd\\Client::PERMISSION_READWRITE, 'redis');\n\n// revoke a key or range permission of a specified role\n$client-\u003erevokeRolePermission('admin', 'redis');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouqiang%2Fetcd-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fouqiang%2Fetcd-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fouqiang%2Fetcd-php/lists"}