PHPackages                             liupan-v/think-theme - 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. liupan-v/think-theme

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

liupan-v/think-theme
====================

thinkpkp5.1的一个无侵入式多主题扩展

v2.0.1(7y ago)31.9k4[2 issues](https://github.com/liupan-v/think-theme/issues)Apache-2.0PHP

Since Mar 19Pushed 7y agoCompare

[ Source](https://github.com/liupan-v/think-theme)[ Packagist](https://packagist.org/packages/liupan-v/think-theme)[ RSS](/packages/liupan-v-think-theme/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (5)Used By (0)

ThinkPHP 5.1 多主题模板扩展
====================

[](#thinkphp-51-多主题模板扩展)

安装
--

[](#安装)

composer require liupan-v/think-theme 2.\*

优点
--

[](#优点)

1.无侵入式, 不影响原来控制器的代码
2.可以最少模板代码实现主题的制作，新增主题主要新增差异部分，其他的模板调用默认主题相应位置的，不用重复编写便于维护

使用方法
----

[](#使用方法)

复制本项目下config目录下的think\_theme.php配置文件到你需要开启多主题功能的模块config目录下，并按注释进行相应配置
控制器或其他地方动态修改think\_theme配置current的值，可实现模板的切换

##### 举个栗子：

[](#举个栗子)

1. 新建一个tp5项目： composer create-project topthink/think tp5test (tp5test是项目目录，cd进入这个目录)
2. 安装主题插件：composer require liupan-v/think-theme 2.\*
3. 复制配置文件：vendor/liupan-v/think-theme/config/think\_theme.php复制到application/index/config/think\_theme.php
4. 修改think\_theme.php配置信息：

> return \[
> 'is\_open' =&gt; true, //是否启用多主题配置，false为不开启，走框架默认的模板驱动
> 'current' =&gt; 'theme1', //必填，当前主题名称，可在代码里动态赋值来改变当前主题
> 'default' =&gt; 'default', //必填，默认主题名称
> 'theme\_path' =&gt; 'theme', //必填，可为空，主题目录地址，上级是对应的模块地址，如填theme，默认主题的路径则为application/模块名/theme/default
> \];

5. 模板文件路径application/index/theme/theme1 注意事项
----

[](#注意事项)

不要在要开启多主题的模块下，修改配置文件的template.type配置信息，即template.php配置里的type配置，否则多主题不会生效

其他
--

[](#其他)

tp5.0的多主题：

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 78.9% 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 ~0 days

Total

2

Last Release

2608d ago

Major Versions

v1.0.1 → v2.0.12019-03-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/5059d88870483b172464b9b23c35278326753d21911d0b6c7f1955d0a90326c4?d=identicon)[liupan-v](/maintainers/liupan-v)

---

Top Contributors

[![mypackages](https://avatars.githubusercontent.com/u/25891054?v=4)](https://github.com/mypackages "mypackages (15 commits)")[![liupan-v](https://avatars.githubusercontent.com/u/48558132?v=4)](https://github.com/liupan-v "liupan-v (4 commits)")

### Embed Badge

![Health badge](/badges/liupan-v-think-theme/health.svg)

```
[![Health](https://phpackages.com/badges/liupan-v-think-theme/health.svg)](https://phpackages.com/packages/liupan-v-think-theme)
```

###  Alternatives

[topthink/think-captcha

captcha package for thinkphp

132934.4k67](/packages/topthink-think-captcha)[topthink/think-worker

workerman extend for thinkphp

202227.2k9](/packages/topthink-think-worker)[yunwuxin/think-cron

计划任务

17416.2k](/packages/yunwuxin-think-cron)[zzstudio/think-addons

The ThinkPHP6 Addons Package

1518.6k](/packages/zzstudio-think-addons)[topthink/think-annotation

Annotation For ThinkPHP

4831.5k8](/packages/topthink-think-annotation)[liliuwei/thinkphp-jump

适用于thinkphp6.0的跳转扩展

2874.4k1](/packages/liliuwei-thinkphp-jump)

PHPackages © 2026

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