{"id":13459373,"url":"https://github.com/phalapi/phalapi","last_synced_at":"2026-01-29T06:03:33.781Z","repository":{"id":32594896,"uuid":"36178323","full_name":"phalapi/phalapi","owner":"phalapi","description":"PhalApi开源接口框架，简称π框架，一个轻量级PHP开源接口框架，专注于接口服务开发。接口，从简单开始！","archived":false,"fork":false,"pushed_at":"2025-07-24T07:46:41.000Z","size":14991,"stargazers_count":1590,"open_issues_count":31,"forks_count":373,"subscribers_count":92,"default_branch":"master-2x","last_synced_at":"2025-08-30T05:28:06.886Z","etag":null,"topics":["api","api-framework","microservice","phalapi","php-framework","phpapi","restful","soap-web-services"],"latest_commit_sha":null,"homepage":"http://www.phalapi.net","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phalapi.png","metadata":{"files":{"readme":"README.en.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-05-24T15:19:48.000Z","updated_at":"2025-08-24T12:49:10.000Z","dependencies_parsed_at":"2024-06-21T18:57:24.219Z","dependency_job_id":"9e3b7244-f551-4936-bac8-25f100e79525","html_url":"https://github.com/phalapi/phalapi","commit_stats":{"total_commits":1086,"total_committers":33,"mean_commits":32.90909090909091,"dds":"0.18047882136279925","last_synced_commit":"dbc437a1ba3ebe7fac6388cf9e91fb705f0b7477"},"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"purl":"pkg:github/phalapi/phalapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phalapi%2Fphalapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phalapi%2Fphalapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phalapi%2Fphalapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phalapi%2Fphalapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phalapi","download_url":"https://codeload.github.com/phalapi/phalapi/tar.gz/refs/heads/master-2x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phalapi%2Fphalapi/sbom","scorecard":{"id":730448,"data":{"date":"2025-08-11","repo":{"name":"github.com/phalapi/phalapi","commit":"ed71590771258f241bce4b50b818e08760ad72c5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}}]},"last_synced_at":"2025-08-22T14:15:23.459Z","repository_id":32594896,"created_at":"2025-08-22T14:15:23.459Z","updated_at":"2025-08-22T14:15:23.459Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28865232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T05:56:06.453Z","status":"ssl_error","status_checked_at":"2026-01-29T05:55:57.668Z","response_time":59,"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":["api","api-framework","microservice","phalapi","php-framework","phpapi","restful","soap-web-services"],"created_at":"2024-07-31T09:01:18.927Z","updated_at":"2026-01-29T06:03:33.751Z","avatar_url":"https://github.com/phalapi.png","language":"PHP","funding_links":[],"categories":["CSS","restful","类库"],"sub_categories":["API文档"],"readme":"![apic](http://cdn7.okayapi.com/yesyesapi_20190709223344_8aadbcfdbfa297a193012c0dada32a58.jpeg)  \n\n# [PhalApi开源接口框架 / PhalApi API Framework](https://www.phalapi.net/)   \n\n\u003e 读音：派框架\n\n[![Latest Stable Version](https://poser.pugx.org/phalapi/phalapi/v/stable)](https://packagist.org/packages/phalapi/phalapi)\n[![Total Downloads](https://poser.pugx.org/phalapi/phalapi/downloads)](https://packagist.org/packages/phalapi/phalapi)\n[![Latest Unstable Version](https://poser.pugx.org/phalapi/phalapi/v/unstable)](https://packagist.org/packages/phalapi/phalapi)\n[![License](https://poser.pugx.org/phalapi/phalapi/license)](https://packagist.org/packages/phalapi/phalapi)\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/phalapi/phalapi.svg)](https://starchart.cc/phalapi/phalapi)\n   \n   \n## 开发文档 / Documents\n专为PHPer准备的优雅而详细的开发文档，请看：[PhalApi 2.x 开发文档](http://docs.phalapi.net/#/v2.0/)。  \n[PhalApi 2.x English Docs](http://docs-en.phalapi.net/#/v2.0/).  \n\n## 在线示例 / Demo\n + 默认接口服务：[http://demo.phalapi.net/?s=App.Site.Index](http://demo.phalapi.net/?s=App.Site.Index)\n + 在线接口文档：[http://demo.phalapi.net/docs.php](http://demo.phalapi.net/docs.php)\n + 接口详情文档（以默认接口为例）：[http://demo.phalapi.net/docs.php?service=App.Site.Index\u0026detail=1\u0026type=fold](http://demo.phalapi.net/docs.php?service=App.Site.Index\u0026detail=1\u0026type=fold)\n \n## 快速安装 / Install\n\n### composer一键安装 / Install by composer\n\n使用composer创建项目的命令，可实现一键安装。  \n\nOne-click installation can be achieved by using the command of composer to create a project.  \n\n```bash\n$ composer create-project phalapi/phalapi\n```\n\u003e 温馨提示：关于composer的使用，请参考[Composer 中文网 / Packagist 中国全量镜像](http://www.phpcomposer.com/)。  \n\n### 手动下载安装 / Download and Install manually\n\n或者，也可以进行手动安装。将此Git项目代码下载解压后，进行可选的composer更新，即：  \nAlternatively, manual installation is also possible. Download PhalApi Project master-2x branch Source code. After downloading and unzipping, perform an optional composer update:  \n```bash\n$ composer update\n```\n\n## 部署 / Deployment\n\n### Nginx配置 / Nginx Configuration\n如果使用的是Nginx，可参考以下配置。  \nIf you are using Nginx, you can refer to the following configuration.  \n```\nserver {\n    listen 80;\n    server_name dev.phalapi.net;\n    # 将根目录设置到public目录\n    root /path/to/phalapi/public;\n    charset utf-8;\n\n    location / {\n        index index.php;\n    }\n\n    location ~ \\.php$ {\n        fastcgi_split_path_info ^(.+\\.php)(/.+)$;\n        # 根据当前环境，选择合适的通讯方式\n        # fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;\n        fastcgi_pass 127.0.0.1:9000;\n        fastcgi_index index.php;\n        include fastcgi_params;\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n    }\n}\n```\n配置时需要将网站根目录设置到public目录，配置保存后重启nginx。  \nPoint the root path of the visit to public folder. Save and reload nginx.  \n\n\u003e 温馨提示：推荐将访问根路径指向/path/to/phalapi/public。  \n\u003e Tips: It is recommended to point the root path of the visit to /path/to/phalapi/public.\n\n### 数据库配置 / Database Configuration\n如何使用的是MySQL数据库，参考修改```./config/dbs.php```数据库配置。  \nIf you are using MySQL, please edit ```./config/dbs.php```.  \n\n```php\nreturn array(\n    /**\n     * DB数据库服务器集群 / database cluster\n     */\n    'servers' =\u003e array(\n        'db_master' =\u003e array(                       // 服务器标记 / database identify\n            'type'      =\u003e 'mysql',                 // 数据库类型，暂时只支持：mysql, sqlserver / database type\n            'host'      =\u003e '127.0.0.1',             // 数据库域名 / database host\n            'name'      =\u003e 'phalapi',               // 数据库名字 / database name\n            'user'      =\u003e 'root',                  // 数据库用户名 / database user\n            'password'  =\u003e '',\t                    // 数据库密码 / database password\n            'port'      =\u003e 3306,                    // 数据库端口 / database port\n            'charset'   =\u003e 'UTF8',                  // 数据库字符集 / database charset\n            'pdo_attr_string'   =\u003e false,           // 数据库查询结果统一使用字符串，true是，false否\n            'driver_options' =\u003e array(              // PDO初始化时的连接选项配置\n                // 若需要更多配置，请参考官方文档：https://www.php.net/manual/zh/pdo.constants.php\n            ),\n        ),\n    ),\n\n    // 更多代码省略……\n);\n```\n\n最后，需要给runtime目录添加写入权限。更多安装说明请参考文档[下载与安装](http://docs.phalapi.net/#/v2.0/download-and-setup)。  \nAt last, add writeable permission to folder ```runtime```. For more detail about installation, refer to [Download and Installation](https://docs-en.phalapi.net/#/v2.0/download-and-setup).   \n\n## 使用 / Usage\n\n### 调用接口 / API Request\n\n在PhalApi，你可以通过service参数（短名字是s参数）指定需要调用的接口服务。例如，访问默认接口服务。  \n\nFor PhalApi, the default communicate protocol is HTTP/HTTPS. According to the specific implementation of the API service, we could use GET or POST to request. By default, you can specify the ```service``` parameter or ```s``` for short when requesting. The default API service is ```App.Site.Index```.    \n\n + 默认接口：[http://dev.phalapi.net/?s=App.Site.Index](http://dev.phalapi.net/?s=App.Site.Index)  \n + Default API：[http://dev.phalapi.net/?s=App.Site.Index](http://dev.phalapi.net/?s=App.Site.Index)  \n\n\n\n对应执行的PHP代码在./src/app/Api/Site.php文件，源码片段如下：  \nThe source PHP code of ```App.Site.Index``` API service is at ```./src/app/Api/Site.php``` file.  \n\n```php\n\u003c?php\nnamespace App\\Api;\nuse PhalApi\\Api;\n\n/**\n * 默认接口服务类\n * @author: dogstar \u003cchanzonghuang@gmail.com\u003e 2014-10-04\n */\nclass Site extends Api {\n    public function getRules() {\n        return array(\n            'index' =\u003e array(\n                'username'  =\u003e array('name' =\u003e 'username', 'default' =\u003e 'PhalApi', 'desc' =\u003e '用户名'),\n            ),\n        );\n    }\n\n    /**\n     * 默认接口服务\n     * @desc 默认接口服务，当未指定接口服务时执行此接口服务\n     * @return string title 标题\n     * @return string content 内容\n     * @return string version 版本，格式：X.X.X\n     * @return int time 当前时间戳\n     * @exception 400 非法请求，参数传递错误\n     */\n    public function index() {\n        return array(\n            'title' =\u003e 'Hello ' . $this-\u003eusername,\n            'version' =\u003e PHALAPI_VERSION,\n            'time' =\u003e $_SERVER['REQUEST_TIME'],\n        );\n    }\n}\n```\n\n接口请求后结果输出类似如下：  \nAPI result as below after requesting:    \n```\n{\n    \"ret\": 200,\n    \"data\": {\n        \"title\": \"Hello PhalApi\",\n        \"version\": \"2.4.2\",\n        \"time\": 1501079142\n    },\n    \"msg\": \"\"\n}\n```\n\n运行效果，截图如下：  \nRuntime Sreenshot:  \n\n![_20190201151943](https://user-images.githubusercontent.com/12585518/52108414-e98d0980-2634-11e9-9e68-9c3fae304a46.png)\n\n### 查看在线接口文档 / Visit Online API List Documents\n\nPhalApi会根据你编写的接口的参数配置和代码注释，自动实时生成在线接口文档。在线接口文档链接为：  \nPhalApi will generate realtime online API documents automatically by PHP code and PHP comments. You can visit them by:  \n \n + 在线接口文档：[http://dev.phalapi.net/docs.php](http://dev.phalapi.net/docs.php)  \n + Online API Docs：[http://dev.phalapi.net/docs.php](http://dev.phalapi.net/docs.php)  \n\n浏览效果类似如下：  \nPreview:  \n![](http://cdn7.okayapi.com/yesyesapi_20200310225952_d319cc197a31f8f3522a82643bf31d60.png)  \n\n![](http://cdn7.okayapi.com/yesyesapi_20200417145333_e8096f41f0ac10dfcd337fad4fdebfdb.png)  \n\n## 翻译 / i18n  \n\n修改```./public/init.php```文件，可设置当前语言。  \nEdit ```./public/init.php``` file to set current language.  \n```php\n// 翻译语言包设定-简体中文\n\\PhalApi\\SL('zh_cn');\n\n// Setting language to English\n\\PhalApi\\SL('en');\n```\n\n## 一张图告诉你如何使用PhalApi 2.x / All in One Picture\n![phalapi-install](https://user-images.githubusercontent.com/12585518/52995681-4ae71200-3456-11e9-8d00-065a42cf4382.gif)\n\n## 子项目 / Sub Projects\n + [phalapi/kernal](https://github.com/phalapi/kernal)框架内核 / Framework Kernal  \n + [phalapi/notorm](https://github.com/phalapi/notorm)数据库包 / Database Library based on NotORM  \n\n## 还有问题，怎么办？/ Any Question?  \n\n如发现问题，或者任何问题，欢迎提交Issue到[这里](https://github.com/phalapi/phalapi/issues)，或进入[PhalApi开源社区](http://talk.phalapi.net/?f=github)。  \n如果喜欢，请帮忙在[Github](https://github.com/phalapi/phalapi)或[码云](https://gitee.com/dogstar/PhalApi)给个Star，也可以对PhalApi进行[捐赠](https://www.phalapi.net/donate.html)哦 ^_^。  \n\nWelcome to report any issue [here](https://github.com/phalapi/phalapi/issues).   \nIf you like PhalApi, welcome to give us a Star at [Github](https://github.com/phalapi/phalapi).  \n\n## 开源许可协议 / Licence\nApache 2.0，Apache Licence是著名的非盈利开源组织Apache采用的协议。该协议和BSD类似，同样鼓励代码共享和尊重原作者的著作权，同样允许代码修改，再发布（作为开源或商业软件）。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphalapi%2Fphalapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphalapi%2Fphalapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphalapi%2Fphalapi/lists"}