PHPackages                             lonefirst/framework - 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. lonefirst/framework

ActiveLibrary[Framework](/categories/framework)

lonefirst/framework
===================

just another framework

v1.0.1(9y ago)418ApachePHPPHP &gt;=7.0.0

Since Nov 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/cnwangjie/LoneFirstFramework)[ Packagist](https://packagist.org/packages/lonefirst/framework)[ RSS](/packages/lonefirst-framework/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (3)Used By (0)

LoneFirstFramework
==================

[](#lonefirstframework)

> Author : Wang Jie

### 安装

[](#安装)

```
#使用composer安装
composer create-project lonefirst/framework project

#从github安装
git clone https://github.com/cnwangjie/LoneFirstFramework.git project
cd project
composer install
```

### 目录结构

[](#目录结构)

```
├─app
│  ├─controllers (用来存放控制器文件)
│  ├─core (框架文件)
│  └─models (用来存放模型文件)
├─cache (用来存放缓存文件)
├─public (用来存放外部文件,请将该目录设置为网站的根目录或将请求内容重定向至此)
└─resources (用来存放各种前端资源)
   └─view(用来存放视图文件)

```

### 设置路由规则

[](#设置路由规则)

- 你可以在 `app/routes.php` 里设置路由规则
- 使用 `$this->reg()` 函数来注册一条路由规则,下面是该函数的使用方法
    - 第一个参数必须为 `string` 类型且不能包含 `/` ,如果需要传入包含该符号的参数请自行进行处理.你可以使某一段以`:`开头来作为参数,路径中的这部分会自动依序成为指定控制器方法的参数
    - 第二个参数可以为 `string` 类型或者 `callback` 类型,用来指定该路由进行的操作,如果要指定一个控制器的某一函数请用`@`来链接控制器名和函数名,如果是一个回掉函数则会直接执行
    - 第三个参数为 `string` 或 `array` 类型,该参数可选,用来指定允许的HTTP方法

实例:

```
$this->reg('name/:id', 'name@getNameById', ['get', 'head']);
// 当访问 yourdomain/name/:id 时将会调用 nameController 中的 getNameById(:id) 函数

$this->reg('say/:hi', function($hi) {echo $hi;});
// 当访问 yourdomain/say/hi 时会显示 'hi'
```

### 使用模型

[](#使用模型)

- 你可以将模型类放在 `app/models/` 目录中
- 框架具有一个模型父类,只要你继承 `core\model` 就可以使用一些通用的函数.你可以阅读 `core/model.php` 中的代码来了解具体它是如何使用的

### 全局函数

[](#全局函数)

框架具有以下全局函数,可以在任何地方使用

#### view()

[](#view)

- 可以显示 `resources/views/` 中的视图
- 第一个必选参数为视图的名称
- 第二个可选参数为要传入的数据
- 返回一个视图类的实例
- 之后如果要传入数据可以使用视图类的 `push()` 函数
- 使用视图类的 `render()` 函数展示视图

#### config()

[](#config)

- 可以返回 `app/configs.php` 中的设置
- 唯一一个参数为所需要的设置,只要在每级之间用`:`来连接就可以了

#### redirect()

[](#redirect)

- 重定向
- 唯一一个参数为要重定向至的URL

#### response()

[](#response)

- 返回一个响应类的实例

### 非常简单的连接到数据库

[](#非常简单的连接到数据库)

框架自带基于PDO的数据库类,可以在任何一个地方使用 `core\database::get()` 都可以返回一个数据库类型的对象

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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 ~4 days

Total

2

Last Release

3523d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1682203?v=4)[wangjie](/maintainers/wangjie)[@wangjie](https://github.com/wangjie)

---

Top Contributors

[![cnwangjie](https://avatars.githubusercontent.com/u/7459652?v=4)](https://github.com/cnwangjie "cnwangjie (43 commits)")

---

Tags

mvc-frameworkphp7

### Embed Badge

![Health badge](/badges/lonefirst-framework/health.svg)

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

###  Alternatives

[laravel/dusk

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

1.9k38.6M289](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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