PHPackages                             boasoft/boaphp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. boasoft/boaphp

ActiveProject[Framework](/categories/framework)

boasoft/boaphp
==============

A flexible and configurable php framework

5103PHP

Since Nov 30Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/poetbi/boaphp)[ Packagist](https://packagist.org/packages/boasoft/boaphp)[ RSS](/packages/boasoft-boaphp/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

介绍
==

[](#介绍)

[![image](https://camo.githubusercontent.com/684b656264d28869716dca24b7f32f2325b4db754a9984370f4712354bc2bad4/687474703a2f2f626f61736f66742e746f702f7265732f6c6f676f2e706e67)](https://camo.githubusercontent.com/684b656264d28869716dca24b7f32f2325b4db754a9984370f4712354bc2bad4/687474703a2f2f626f61736f66742e746f702f7265732f6c6f676f2e706e67)

boaPHP是一款免费开源、灵活易用的配置式PHP框架，MVC设计模式，完全面向对象，易学易用、便于快速开发

支持PHP版本：PHP 7.0 - PHP 8.5 （小版本的更新可以直接覆盖）

帮助
==

[](#帮助)

- 文档：

示例
==

[](#示例)

示例控制器
-----

[](#示例控制器)

```
namespace mod\docs\controller;

use boa\boa;
use boa\msg;
use boa\controller;

class index extends controller{
	public function __construct(){
		parent::__construct();
	}

	public function index(){
		$this->view->assign('title', 'boaPHP开发手册'); //模板赋值
		$this->view->html(); //从模板www/tpl/docs/index/index.html输出html
	}

	public function menu(){
		$model = boa::model('docs.content'); //访问docs模块中content模型
		$data = $model->list_content($this->cid); //从模型获取数据
		// GET/POST/COOKIE数据中的cid可以直接用$this->cid访问，配置验证规则后会自动验证
		$this->view->json($data); //输出json数据
	}
}
```

示例验证规则
------

[](#示例验证规则)

如欲对示例控制器中cid进行验证，可以配置mod/docs/variable/index/menu.php

```
return [
	'cid' => [
		'label' => '栏目ID', //标签名
		'check' => 'required', //检查规则：必需
		'filter' => 'intval' //过滤规则：转为整型
	]
]
```

类的访问
----

[](#类的访问)

boa命名空间下的类可以直接通过boa类访问

```
//使用默认或静态配置（config.php中配置）
boa::cache()->xget('language');

//动态配置一
boa::cache(['expire' => 86400])->get('language');

//动态配置二
$cookie = boa::cookie();
$cookie->cfg('expire', 86400);
$cookie->get('language');
```

控制器之间的访问
--------

[](#控制器之间的访问)

```
//后端调用其他控制器方法并返回结果，可以带参数
$res = boa::call('news.content.show', ['id' => 1]);
```

访问模块中的库
-------

[](#访问模块中的库)

```
//访问/mod/admin/library/test.php中get()方法
boa::lib('admin.test')->get();
```

数据库操作
-----

[](#数据库操作)

```
//访问database类，等同boa::database()
$db = boa::db();
$data = ['title'=>'Title', 'content'=>'Content'];

$res = $db->table('news')->insert($data); //插入
$res = $db->table('news')->where('id = ?', $id)->delete(); //删除
$res = $db->table('news')->where('id = ?', $id)->update($data); //更新

//联合查询
$arr = $db->table('news A')
->field('A.*, B.category AS cat, COUNT(C.*) total')
->join('category B', 'A.cid = B.id')
->join('tag C', 'A.id = C.pid')
->where('A.cid = ? AND A.status = 1', $cid)
->limit(50, 10)
->order('A.sort ASC, A.id DESC')
->select();

//单行查询
$arr = $db->table('news')->where('id = ?', $id)->find();
```

示例模板
----

[](#示例模板)

示例控制器中的模板www/tpl/docs/index/index.html

```
{inc inc.head} //包含inc/head.html

{$arr news.content.show {$id}} //获取模型数据，参数$id

{$i++}
{list $arr $k $v} //循环输出$arr
	{$i++} : {$k} => {$v}  //自定义从1开始的序号
{/list}

{date Y-m-d {time}} //调用date函数，支持嵌套time函数

{if {$var} == abc or ($a > 1 && $b == 2)} //多条件判断
	...
{elseif {date Y-m-d} == 2020-02-02 || $c == 3}
	...
{else}
	...
{/if}

{@news.error.1001} //调用news模块语言包中error.php中1001标签
```

多语言
---

[](#多语言)

```
//调用boa内核语言包中error.php中2标签，带替换参数
boa::lang('boa.error.2', 'home/controller/test.php');

//调用home模块语言包中news.php中title标签
boa::lang('home.news.title');
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance48

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f53aeec89084c1d16fa96419668ced4616eb92c7ae533d7308e1cfb1bc94978e?d=identicon)[poetbi](/maintainers/poetbi)

---

Top Contributors

[![poetbi](https://avatars.githubusercontent.com/u/524042?v=4)](https://github.com/poetbi "poetbi (29 commits)")

---

Tags

php-framework

### Embed Badge

![Health badge](/badges/boasoft-boaphp/health.svg)

```
[![Health](https://phpackages.com/badges/boasoft-boaphp/health.svg)](https://phpackages.com/packages/boasoft-boaphp)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
