{"id":20842211,"url":"https://github.com/nauxliu/opencc4php","last_synced_at":"2025-10-26T08:48:05.097Z","repository":{"id":23368686,"uuid":"26729936","full_name":"nauxliu/opencc4php","owner":"nauxliu","description":"简繁体转换 PHP 扩展","archived":false,"fork":false,"pushed_at":"2024-06-27T17:02:45.000Z","size":53,"stargazers_count":461,"open_issues_count":11,"forks_count":83,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-03-28T15:06:59.601Z","etag":null,"topics":["chinese-translation","opencc","opencc-php","simplified-chinese","traditional-chinese"],"latest_commit_sha":null,"homepage":"","language":"C","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/nauxliu.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}},"created_at":"2014-11-16T22:13:35.000Z","updated_at":"2025-03-12T02:49:35.000Z","dependencies_parsed_at":"2024-11-25T02:01:12.481Z","dependency_job_id":"2cf19924-a13f-4f1e-82b3-7c4d93738d8e","html_url":"https://github.com/nauxliu/opencc4php","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/nauxliu%2Fopencc4php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nauxliu%2Fopencc4php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nauxliu%2Fopencc4php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nauxliu%2Fopencc4php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nauxliu","download_url":"https://codeload.github.com/nauxliu/opencc4php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208151,"owners_count":20901570,"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":["chinese-translation","opencc","opencc-php","simplified-chinese","traditional-chinese"],"created_at":"2024-11-18T01:23:29.271Z","updated_at":"2025-10-26T08:48:05.023Z","avatar_url":"https://github.com/nauxliu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# opencc4php\n\n[![Build Status](https://github.com/nauxliu/opencc4php/workflows/Main/badge.svg)](https://github.com/nauxliu/opencc4php/actions) \n[![LICENSE](https://img.shields.io/github/license/nauxliu/opencc4php)](https://github.com/nauxliu/opencc4php/blob/master/LICENSE) \n\nopencc4php 是 [OpenCC](https://github.com/BYVoid/OpenCC) 的PHP扩展，能很智能的完成简繁体转换。 \n\n支持 PHP 版本： 7.1 - 8.0\n\n### 转换效果：\n\n`你干什么不干我事` =\u003e `你幹什麼不干我事`\n\n地区词汇转换效果：  \n`我鼠标哪儿去了` =\u003e `我滑鼠哪兒去了`\n\n# 安装\n\n## Linux | OS X\n\n你需要先安装`1.0.1` 版本以上的OpenCC\n\n#### Ubuntu:\n\n```\napt-get install libopencc-dev -y\n```\n\n#### 从源码安装\n\n```\ngit clone https://github.com/BYVoid/OpenCC.git --depth 1\ncd OpenCC\nmake\nsudo make install\n```\n\n### 安装opencc4php：\n\n```\ngit clone git@github.com:nauxliu/opencc4php.git --depth 1\ncd opencc4php\nphpize\n./configure\nmake \u0026\u0026 sudo make install\n```\n\u003e如果你的OpenCC安装目录不在`/usr`或`/usr/local`，可在`./configure`时添加`--with-opencc=[DIR]`指定你的OpenCC目录\n\n\n## Windows\n[Windows 安装说明](https://github.com/nauxliu/opencc4php/pull/16)\n\n# 使用\n\n### 实例：\n```php\n$od = opencc_open(\"s2twp.json\"); //传入配置文件名\n$text = opencc_convert(\"我鼠标哪儿去了。\", $od);\necho $text;\nopencc_close($od);\n```\n输出:\n`我滑鼠哪兒去了`\n\n### 函数列表：\n\n`opencc_open(string ConfigName)`  ConfigName:配置文件名，成功返回资源对象，失败返回false  \n`opencc_close(resource ob)`  关闭资源对象,成功返回true，失败返回false.   \n`opencc_error()` 返回最后一条错误信息，有错误信息返回String,无错误返回false  \n`opencc_convert(string str, resource od)` str：要转换的字符串(UTF-8)，od：opencc资源对象  \n\n\n### 可用配置\n* `s2t.json` 简体到繁体 \n* `t2s.json` 繁体到简体 \n* `s2tw.json` 简体到台湾正体 \n* `tw2s.json` 台湾正体到简体 \n* `s2hk.json` 简体到香港繁体（香港小学学习字词表标准） \n* `hk2s.json` 香港繁体（香港小学学习字词表标准）到简体 \n* `s2twp.json` 简体到繁体（台湾正体标准）并转换为台湾常用词汇 \n* `tw2sp.json` 繁体（台湾正体标准）到简体并转换为中国大陆常用词汇\n\n# 贡献列表\n[@刘相轩](https://github.com/nauxliu)  \n[@Kyle Tse](https://github.com/shtse8)  \n[@Alliumcepa Triplef](https://github.com/fffonion)  \n[@acgrid](https://github.com/acgrid)  \n[@pkujhd](https://github.com/pkujhd)  \n[@bc](https://github.com/bclow)  \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnauxliu%2Fopencc4php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnauxliu%2Fopencc4php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnauxliu%2Fopencc4php/lists"}