PHPackages                             aicode/focusphp - 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. aicode/focusphp

ActiveLibrary[Framework](/categories/framework)

aicode/focusphp
===============

FocusPHP 微框架

0.1.1(10y ago)5653MITPHPPHP &gt;=5.6

Since Oct 23Pushed 9y ago5 watchersCompare

[ Source](https://github.com/mylxsw/FocusPHP)[ Packagist](https://packagist.org/packages/aicode/focusphp)[ RSS](/packages/aicode-focusphp/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

FocusPHP
========

[](#focusphp)

FocusPHP is a micro php framework

[![Build Status](https://camo.githubusercontent.com/1ffb0643bafee414c5ee09e8c8960d62c90b961d8595235935a294823fed42d8/68747470733a2f2f7472617669732d63692e6f72672f6d796c7873772f466f6375735048502e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mylxsw/FocusPHP)

TODO
----

[](#todo)

- 完善docker开发环境
- 增加后台管理
- 框架与项目分离
- 完善单元测试，使用Travis CI持续集成

备注
--

[](#备注)

数据库文件中，username=admin, password=administrator

安装使用
----

[](#安装使用)

```
composer require aicode/focusphp

```

### MVC支持

[](#mvc支持)

框架本身可选的对`MVC`提供了支持，只需要在创建`Focus\Server`对象时注册`Focus\MVC\Router`对象即可。

```
$server->registerRouter(new Focus\MVC\Router('Demo\Controllers'));

```

创建`Focus\MVC\Router`是需要提供控制器命名空间作为参数，这样框架就回到该命名空间下寻找适合处理当前请求的控制器。

#### 视图对象

[](#视图对象)

视图类需要实现`Focus\MVC\View`接口，框架内置了一套简单的视图实现`Focus\MVC\SimpleView`， 该实现使用`.php`文件作为视图文件模板，在模板文件中，直接使用原始的PHP语法即可。

默认视图`Focus\MVC\SimpleView`提供了layout支持。

隐藏的模板变量

变量名说明`__body__`解析模板后的内容，该变量只在layout中可用`__data__`给模板对象传递的字符串数据（无key）### 框架异常消息

[](#框架异常消息)

消息含义INVALID\_ROUTER路由不合法INVALID\_ROUTER\_ARGS路由参数不合法INVALID\_ROUTER\_FUNC路由规则执行函数不合法NONSUPPORT\_PHP\_VERSIONPHP版本不支持，请使用5.6.0以上版本CONFIG\_FILE\_NOT\_FOUND配置文件不存在INVALID\_CONFIG\_FORMAT不合法的配置文件格式### 日志

[](#日志)

如果定义了`FOCUS_DEBUG`常量,并且该常量的值为true,则启用框架日志,框架日志将合并到应用的debug日志中, 默认情况下是不开启框架的日志的.

> 框架记录的所有日志均为debug日志

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~68 days

Total

2

Last Release

3792d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1718739c6e15153bb1cecfa84cfe02b138bf07cd921648dffcdf9e2c36e185c1?d=identicon)[mylxsw](/maintainers/mylxsw)

---

Top Contributors

[![mylxsw](https://avatars.githubusercontent.com/u/2330911?v=4)](https://github.com/mylxsw "mylxsw (52 commits)")

---

Tags

phpframeworkfocus

### Embed Badge

![Health badge](/badges/aicode-focusphp/health.svg)

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

###  Alternatives

[phalcon/phalcon

Phalcon Framework

2421.5k1](/packages/phalcon-phalcon)[letsdrink/ouzo

Ouzo PHP MVC framework

7210.5k1](/packages/letsdrink-ouzo)[phphleb/webrotor

Asynchronous PHP web server for shared hosting

631.5k1](/packages/phphleb-webrotor)[nimbly/syndicate

A powerful queue and pubsub message publisher and consumer framework.

304.2k](/packages/nimbly-syndicate)

PHPackages © 2026

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