PHPackages                             wall2flower/yaf-library - 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. wall2flower/yaf-library

ActiveLibrary

wall2flower/yaf-library
=======================

yaf-library

021PHP

Since Jul 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/wall2flower/yaf-library)[ Packagist](https://packagist.org/packages/wall2flower/yaf-library)[ RSS](/packages/wall2flower-yaf-library/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

依赖
--

[](#依赖)

- PHP
- Yaf 扩展
- Composer

组件
--

[](#组件)

yaf框架本身是一个比较精简的MVC框架, 本身并没有提供其他类库, 本项目主要提供了一些常用到的组件:

- 验证码 Captcha
- 数据库 ORM
- Http
- Cache
    - Redis
    - Memcached
- 日志
- 上传组件
- 校验
- 视图
- 事件
- 依赖注入

安装
--

[](#安装)

### 安装类库

[](#安装类库)

方式一(用于单项目):

```
composer require phpcasts/yaf-library -vvv
```

方式二(用于多项目共享):

```
git clone https://github.com/qloog/yaf-library
```

修改配置文件的: application.library = APP\_PATH "/library" 为: application.library = APP\_ROOT "/../yaf-library"

> PS: yaf-library与项目在同一级目录, 达到多项目共享一套 `yaf-library` 的目的,便于维护和管理

### 添加配置

[](#添加配置)

打开 conf/application.ini, 添加一下配置:

```
; cache
cache.type = redis
cache.redis = default

; Redis
redis.default.host = 127.0.0.1
redis.default.port = 6379

;database
database.driver     = mysql
database.host       = localhost
database.database   = test
database.username   = root
database.password   = 123456
database.port       = 3306
database.charset    = utf8
database.collation  = utf8_unicode_ci
database.prefix     = ""

; Log
log.level = debug
log.channel = default
log.file.dir = APP_ROOT "/storage/logs"
```

### 添加常量定义

[](#添加常量定义)

一般定义在public/index.php文件中

```
define('APP_ROOT', dirname(__DIR__));
define('APP_PATH', APP_ROOT . '/application');
```

Usage
-----

[](#usage)

以使用Cache为例:

```
use PHPCasts\Yaf\Caches\Cache;
...

 $cache = Cache::getInstance();
 $cache->set('test', 'test-value');
```

实际使用
----

[](#实际使用)

- [yaf-skeleton](https://github.com/qloog/yaf-skeleton)

Docs
----

[](#docs)

- Yaf Docs:

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% 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/3fdd3ce728ef05e7ccccbcf333755c92af1280514f4858d70923be51cb18a555?d=identicon)[wall2flower](/maintainers/wall2flower)

---

Top Contributors

[![qloog](https://avatars.githubusercontent.com/u/3043638?v=4)](https://github.com/qloog "qloog (48 commits)")[![ya-luotao](https://avatars.githubusercontent.com/u/7478427?v=4)](https://github.com/ya-luotao "ya-luotao (3 commits)")

### Embed Badge

![Health badge](/badges/wall2flower-yaf-library/health.svg)

```
[![Health](https://phpackages.com/badges/wall2flower-yaf-library/health.svg)](https://phpackages.com/packages/wall2flower-yaf-library)
```

PHPackages © 2026

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