{"id":37015653,"url":"https://github.com/poetbi/boaphp","last_synced_at":"2026-01-14T01:35:47.124Z","repository":{"id":199094261,"uuid":"702131877","full_name":"poetbi/boaphp","owner":"poetbi","description":"boaPHP是一款免费开源、灵活易用的配置式PHP框架，MVC设计模式，完全面向对象，易学易用、便于快速开发","archived":false,"fork":false,"pushed_at":"2025-11-30T03:02:51.000Z","size":5296,"stargazers_count":53,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-02T07:35:44.245Z","etag":null,"topics":["php-framework"],"latest_commit_sha":null,"homepage":"","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/poetbi.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-10-08T15:34:27.000Z","updated_at":"2025-11-30T03:02:54.000Z","dependencies_parsed_at":"2025-12-14T02:05:15.958Z","dependency_job_id":null,"html_url":"https://github.com/poetbi/boaphp","commit_stats":null,"previous_names":["poetbi/boaphp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/poetbi/boaphp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poetbi%2Fboaphp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poetbi%2Fboaphp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poetbi%2Fboaphp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poetbi%2Fboaphp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/poetbi","download_url":"https://codeload.github.com/poetbi/boaphp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/poetbi%2Fboaphp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T00:40:43.272Z","status":"ssl_error","status_checked_at":"2026-01-14T00:40:42.636Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["php-framework"],"created_at":"2026-01-14T01:35:46.345Z","updated_at":"2026-01-14T01:35:47.102Z","avatar_url":"https://github.com/poetbi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 介绍\n![image](http://boasoft.top/res/logo.png)\n\nboaPHP是一款免费开源、灵活易用的配置式PHP框架，MVC设计模式，完全面向对象，易学易用、便于快速开发\n\n支持PHP版本：PHP 7.0 - PHP 8.5 （小版本的更新可以直接覆盖）\n\n# 帮助\n* 文档：http://boasoft.top/docs/\n\n# 示例\n## 示例控制器\n```php\nnamespace mod\\docs\\controller;\n\nuse boa\\boa;\nuse boa\\msg;\nuse boa\\controller;\n\nclass index extends controller{\n\tpublic function __construct(){\n\t\tparent::__construct();\n\t}\n\n\tpublic function index(){\n\t\t$this-\u003eview-\u003eassign('title', 'boaPHP开发手册'); //模板赋值\n\t\t$this-\u003eview-\u003ehtml(); //从模板www/tpl/docs/index/index.html输出html\n\t}\n\n\tpublic function menu(){\n\t\t$model = boa::model('docs.content'); //访问docs模块中content模型\n\t\t$data = $model-\u003elist_content($this-\u003ecid); //从模型获取数据\n\t\t// GET/POST/COOKIE数据中的cid可以直接用$this-\u003ecid访问，配置验证规则后会自动验证\n\t\t$this-\u003eview-\u003ejson($data); //输出json数据\n\t}\n}\n```\n## 示例验证规则\n如欲对示例控制器中cid进行验证，可以配置mod/docs/variable/index/menu.php\n```php\nreturn [\n\t'cid' =\u003e [\n\t\t'label' =\u003e '栏目ID', //标签名\n\t\t'check' =\u003e 'required', //检查规则：必需\n\t\t'filter' =\u003e 'intval' //过滤规则：转为整型\n\t]\n]\n```\n## 类的访问\nboa命名空间下的类可以直接通过boa类访问\n```php\n//使用默认或静态配置（config.php中配置）\nboa::cache()-\u003exget('language');\n\n//动态配置一\nboa::cache(['expire' =\u003e 86400])-\u003eget('language');\n\n//动态配置二\n$cookie = boa::cookie();\n$cookie-\u003ecfg('expire', 86400);\n$cookie-\u003eget('language');\n```\n## 控制器之间的访问\n```php\n//后端调用其他控制器方法并返回结果，可以带参数\n$res = boa::call('news.content.show', ['id' =\u003e 1]);\n```\n## 访问模块中的库\n```php\n//访问/mod/admin/library/test.php中get()方法\nboa::lib('admin.test')-\u003eget();\n```\n## 数据库操作\n```php\n//访问database类，等同boa::database()\n$db = boa::db();\n$data = ['title'=\u003e'Title', 'content'=\u003e'Content'];\n\n$res = $db-\u003etable('news')-\u003einsert($data); //插入\n$res = $db-\u003etable('news')-\u003ewhere('id = ?', $id)-\u003edelete(); //删除\n$res = $db-\u003etable('news')-\u003ewhere('id = ?', $id)-\u003eupdate($data); //更新\n\n//联合查询\n$arr = $db-\u003etable('news A')\n-\u003efield('A.*, B.category AS cat, COUNT(C.*) total')\n-\u003ejoin('category B', 'A.cid = B.id')\n-\u003ejoin('tag C', 'A.id = C.pid')\n-\u003ewhere('A.cid = ? AND A.status = 1', $cid)\n-\u003elimit(50, 10)\n-\u003eorder('A.sort ASC, A.id DESC')\n-\u003eselect();\n\n//单行查询\n$arr = $db-\u003etable('news')-\u003ewhere('id = ?', $id)-\u003efind();\n```\n## 示例模板\n示例控制器中的模板www/tpl/docs/index/index.html\n```javascript\n{inc inc.head} //包含inc/head.html\n\n{$arr news.content.show {$id}} //获取模型数据，参数$id\n\n{$i++}\n{list $arr $k $v} //循环输出$arr\n\t{$i++} : {$k} =\u003e {$v} \u003cbr\u003e //自定义从1开始的序号\n{/list}\n\n{date Y-m-d {time}} //调用date函数，支持嵌套time函数\n\n{if {$var} == abc or ($a \u003e 1 \u0026\u0026 $b == 2)} //多条件判断\n\t...\n{elseif {date Y-m-d} == 2020-02-02 || $c == 3}\n\t...\n{else}\n\t...\n{/if}\n\n{@news.error.1001} //调用news模块语言包中error.php中1001标签\n```\n## 多语言\n```php\n//调用boa内核语言包中error.php中2标签，带替换参数\nboa::lang('boa.error.2', 'home/controller/test.php');\n\n//调用home模块语言包中news.php中title标签\nboa::lang('home.news.title');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoetbi%2Fboaphp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpoetbi%2Fboaphp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpoetbi%2Fboaphp/lists"}