PHPackages                             l-addons/think-addons - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. l-addons/think-addons

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

l-addons/think-addons
=====================

Simple Addons Package For TP5

2123PHP

Since Mar 19Pushed 7y agoCompare

[ Source](https://github.com/ppyylee/think-addons)[ Packagist](https://packagist.org/packages/l-addons/think-addons)[ RSS](/packages/l-addons-think-addons/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

think-addons
============

[](#think-addons)

Simple Addons

#### 开发文档

[](#开发文档)

> PHP&gt;=5.4.0

> think-helper &gt;= 1.0.4

1. 安装think-addons

    `composer require l-addons/think-addons`
2. 目录结构

    ```
    www                     项目目录
    ├─addons                插件目录
    │  ├─addonsone           插件模块目录(自定义)
    │  │  ├─controller      控制器目录
    │  │  ├─view            视图目录
    │  │  ├─model           模型目录
    │  │  ├─...             其他TP5目录结构
    │  │  ├─Addonsone.php   插件基类（以模块名命名）
    │  │  └─config.php      插件配置
    │  ├─addonstwo            插件模块目录(自定义)
    │  │  ├─...

    ```
3. 插件开发基类规范

    ```
    //Addonsonone.php

    namespace addons\assistAct;
    use think\Addons;

    class Addonsone extends Addons
    {
        /**
         * 工具信息描述
         * @var array
         */
        protected $info = [
            'name' => '',   //插件名称
            'title' => '',  //插件标题
            'description' => '',//插件描述
            'status' => false,
            'author' => '', //插件作者
            'version' => '' //插件版本
        ];

        /**
         * 工具创建
         */
        public function build(){
            //TODO 创建插件所需要的环境
            //例如：数据库添加表
        }

        /**
         * 工具的安装
         */
        public  function install()
        {
            //生成安装文件
            @touch($this->addons_path.'install.lock');
            //TODO  其他安装流程

        }

        /**
         * 工具的卸载
         */
        public  function uninstall()
        {
            //TODO 更新数据库等
            file_exists($this->addons_path.'install.lock') && unlink($this->addons_path.'install.lock');

        }

        //添加插件钩子，易于区分，命名规范以Hook结尾
        public function wapadminHook()
        {
              // return $this->fetch('index');

        }

    }

    ```
4. 助手函数

> URL生成 `aurl()`

```
```
//用法
aurl('addonsone://admin/index',array('id'=>1))
//    addonsone://admin/index    模块名://控制器名/操作名
/addons/exec/addonsone-admin-index
```

```

> 初始化sql `init_sql()`

```
```
//用法
init_sql($sql_file);
//返回包含初始化后的sql语句数组
```

```

5. 配置文件 `extra/addons`

    ```
    添加配置文件extra/addons.php
    return [
        'autoload'=>true,  //自动加载钩子（debug模式）
            'hooks'=>[     //当autoload为false时，加载hooks中的钩子
                'wapadminHook'=>'addonsone' //key为钩子函数，value为对应的插件，多插件可用数组
            ]
    ];

    ```
6. 命令行模式

> php think addons:build {options}

```
options：
    --addons addonsone   用，分隔多个
    --install  创建后执行安装
    --uninstall  执行卸载

    php think  addons:build --addons addonsone //创建插件
    php think  addons:build --addons addonsone --install //创建并安装插件
    php think  addons:build --addons addonsone --uninstall //卸载插件

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

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/d1d70bfcabc500d254983642eecf424be028e5670c1b031386fdd36f4d6105ad?d=identicon)[L1PY](/maintainers/L1PY)

---

Top Contributors

[![ppyylee](https://avatars.githubusercontent.com/u/33045069?v=4)](https://github.com/ppyylee "ppyylee (16 commits)")

### Embed Badge

![Health badge](/badges/l-addons-think-addons/health.svg)

```
[![Health](https://phpackages.com/badges/l-addons-think-addons/health.svg)](https://phpackages.com/packages/l-addons-think-addons)
```

###  Alternatives

[liaison/revision

Seamless software updates library for CodeIgniter4 projects.

186.4k1](/packages/liaison-revision)

PHPackages © 2026

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