{"id":15375297,"url":"https://github.com/sy-records/thrift2-hbase","last_synced_at":"2025-04-15T11:33:09.868Z","repository":{"id":49730227,"uuid":"218395536","full_name":"sy-records/thrift2-hbase","owner":"sy-records","description":"thrift2-hbase component for Hyperf.","archived":false,"fork":false,"pushed_at":"2021-10-29T01:15:03.000Z","size":172,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-01T10:51:31.382Z","etag":null,"topics":["hbase","hyperf","php","swoole","thrift"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/sy-records/thrift2-hbase","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/sy-records.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":"2019-10-29T22:31:29.000Z","updated_at":"2024-01-16T04:31:22.000Z","dependencies_parsed_at":"2022-09-10T08:41:16.599Z","dependency_job_id":null,"html_url":"https://github.com/sy-records/thrift2-hbase","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fthrift2-hbase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fthrift2-hbase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fthrift2-hbase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fthrift2-hbase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sy-records","download_url":"https://codeload.github.com/sy-records/thrift2-hbase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223673050,"owners_count":17183618,"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":["hbase","hyperf","php","swoole","thrift"],"created_at":"2024-10-01T14:02:34.596Z","updated_at":"2024-11-08T11:03:22.622Z","avatar_url":"https://github.com/sy-records.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# thrift2-hbase\n\nthrift2-hbase component for Hyperf.\n\n[![Latest Stable Version](http://poser.pugx.org/sy-records/thrift2-hbase/v)](https://packagist.org/packages/sy-records/thrift2-hbase)\n[![Total Downloads](http://poser.pugx.org/sy-records/thrift2-hbase/downloads)](https://packagist.org/packages/sy-records/thrift2-hbase)\n[![License](http://poser.pugx.org/sy-records/thrift2-hbase/license)](https://packagist.org/packages/sy-records/thrift2-hbase)\n[![PHP Version Require](http://poser.pugx.org/sy-records/thrift2-hbase/require/php)](https://packagist.org/packages/sy-records/thrift2-hbase)\n\n\u003e 此 repo 为使用阿里云云数据库 Hbase 性能增强版，HBase 增强版使用的 Thrift 接口定义是 HBase 的 `thrift2`\n\n## 安装\n\n```shell\ncomposer require sy-records/thrift2-hbase -vvv\n\n#生成 classmap\ncomposer dump-autoload -o\n```\n\n## 在 Hyperf 中使用\n\n### 配置文件\n\n配置文件位于 `config/autoload/hbase.php`，如配置文件不存在可通过执行\n\n```shell\nphp bin/hyperf.php vendor:publish sy-records/thrift2-hbase\n```\n\n命令创建默认配置，配置文件内容如下：\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nreturn [\n    'default' =\u003e [\n        'host' =\u003e env('ALIHBASE_HOST', 'localhost'),\n        'port' =\u003e env('ALIHBASE_PORT', 9190),\n        'key_id' =\u003e env('ALIHBASE_KEYID', 'root'),\n        'signature' =\u003e env('ALIHBASE_SIGNATURE', 'root'),\n    ],\n];\n```\n\n### 添加配置信息\n\n在项目根目录`.env`文件中添加相关配置信息\n\n```dotenv\nALIHBASE_HOST=localhost\nALIHBASE_PORT=9190\nALIHBASE_KEYID=root\nALIHBASE_SIGNATURE=root\n```\n\n参数说明：\n\n|        配置        |  类型  |  默认值   |                             备注                             |\n| :----------------: | :----: | :-------: | :----------------------------------------------------------: |\n|   ALIHBASE_HOST    | string | localhost | 连接信息中的“非 JAVA 语言 Thrift2 访问地址”访问地址部分（注意专有网络地址和外网地址的区别） |\n|   ALIHBASE_PORT    |  int   |   9190    |                         PHP 操作端口                         |\n|   ALIHBASE_KEYID   | string |   root    |                            用户名                            |\n| ALIHBASE_SIGNATURE | string |   root    |                             密码                             |\n\n### 代码提示\n\n在 PhpStorm 中直接操作是没有代码提示的，可添加`@var`使得编辑器增加代码提示，如下所示\n\n```php\n\u003c?php\n\ndeclare(strict_types=1);\n\nnamespace App\\Controller;\n\nuse Hyperf\\Di\\Annotation\\Inject;\nuse Luffy\\AliHbaseThrift\\Service\\AliHbaseThriftInterface;\n\nclass IndexController extends AbstractController\n{\n    /**\n     * 使用注解时\n     * @Inject()\n     * @var AliHbaseThriftInterface\n     */\n    private $hbase;\n\n    public function index()\n    {\n        /**\n         * @var $client \\Luffy\\Thrift2Hbase\\THBaseServiceClient\n         */\n        $client = $this-\u003ehbase-\u003egetClient();\n\n        /**\n         * @var $hbase \\Luffy\\AliHbaseThrift\\Service\\AliHbaseThriftService\n         */\n        $hbase = make(AliHbaseThriftInterface::class);\n\n        /**\n         * @var $client \\Luffy\\Thrift2Hbase\\THBaseServiceClient\n         */\n        $client = $hbase-\u003egetClient();\n\n        $res = $client-\u003eget(\"scanface:test\", new \\Luffy\\Thrift2Hbase\\TGet([\"row\" =\u003e \"001\"]));\n        var_dump($res-\u003ecolumnValues);\n    }\n}\n```\n\n这样操作`$client`或`$hbase`时，编辑器就会给出对应的代码提示。\n\n## 在其他框架中使用\n\n### 配置文件\n\n在对应的配置文件中添加如下配置信息，参数说明见上文\n\n```php\nreturn [\n    'host' =\u003e \"localhost\",\n    'port' =\u003e 9190,\n    'key_id' =\u003e 'root',\n    'signature' =\u003e 'root',\n];\n```\n\n### 使用\n\n```php\n$hbase = new Luffy\\AliHbaseThrift\\Service\\AliHbaseThriftService($config['host'], $config['port'], $config['key_id'], $config['signature']);\n```\n\n## Contributors\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/zzss-utils\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/26597775?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ezhouhua\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/sy-records/thrift2-hbase/commits?author=zzss-utils\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://qq52o.me\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/33931153?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e沈唁\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/sy-records/thrift2-hbase/commits?author=sy-records\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/sy-records/thrift2-hbase/commits?author=sy-records\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/hejunrex\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/16148193?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ehejunrex\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/sy-records/thrift2-hbase/commits?author=hejunrex\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/starfalling\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/532951?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003estarfalling\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/sy-records/thrift2-hbase/commits?author=starfalling\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n## 扩展服务\n\n此仓库是作为操作`Hbase`基础库发布的，另有完整的`Hbase`+`Solr`协程支持组件，操作更加便捷。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsy-records%2Fthrift2-hbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsy-records%2Fthrift2-hbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsy-records%2Fthrift2-hbase/lists"}