PHPackages                             hongyukeji/plugin-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. [Templating &amp; Views](/categories/templating)
4. /
5. hongyukeji/plugin-theme

ActiveLibrary[Templating &amp; Views](/categories/templating)

hongyukeji/plugin-theme
=======================

An opinionated theme system where even the views can be classes, and everything is a plugin.

v1.3.0(6y ago)05MITPHPPHP &gt;=5.3.0

Since Apr 26Pushed 6y agoCompare

[ Source](https://github.com/hongyukeji/plugin-theme)[ Packagist](https://packagist.org/packages/hongyukeji/plugin-theme)[ Docs](http://www.hongyuvip.com)[ RSS](/packages/hongyukeji-plugin-theme/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (6)Used By (0)

Hongyukeji PHP Theme system
===========================

[](#hongyukeji-php-theme-system)

A theme system that abuses OOP to give you those features you've always dreamed of.

You will need PHP 5.4 for this to work. You can install it through [Composer](http://getcomposer.org/) and [Packagist](https://packagist.org/packages/hongyukeji/plugin).

What a mess!
------------

[](#what-a-mess)

Hongyukeji\\PluginTheme works on top of Hongyukeji\\Plugin. This means it has built-in support for plugin-like stuff, that you can use or ignore at will. We use it to allow re-skinning and hooking links on the interface.

We created our own Theme system because other theme systems were nothing more than View managers, monolithic and raw.

This package aims to use a multi-level approach to themes, where you can go up and down in the system and build components at the very last moment - by interacting with the theme directly. The structure goes like this:

- Loader
- Theme
- Builder -&gt; Global Parameter Manager
- View -&gt; Local Parameter Manager

From the View you can bubble up to the Loader, grab the global parameters, enter other partials, and build them within the View.

Other features:

- Child themes: Instead of having to duplicate the entire theme directory, you can extend another theme and fallback on its files. You can also extend from an extended theme, with no limit.
- Asset Manager: compile LESS files on the fly.

Classes
-------

[](#classes)

#### Theme

[](#theme)

The Theme object abstracts the content of the theme. These will be returned by the Loader, and you will be able to choose which to use.

- **$theme-&gt;createBuilder()**

    Returns a new builder. It's used to create the HTML.
- **$theme-&gt;getAssetManager()**

    Returns the asset manager. It's used to load and edit the content of the package that the user will download, like stylesheets and images.

#### Builder

[](#builder)

The builder is used to create the HTML. It divides the job between layouts and partials, and provides a global parameter manager.

- **$builder-&gt;getTheme()**

    Returns the Theme that generated this builder object.
- **$builder-&gt;getParamManager()**

    Returns the parameter manager used to hold parameters for the views.
- **$builder-&gt;createLayout($view)**

    - string *$view* - The name of the layout with underscores

    Sets the layout and returns the View object.
- **$builder-&gt;createPartial($name, $view)**

    - string *$name* - A given name for the partial
    - string *$view* - The name of the layout with underscores

    Sets a partial with the given $name, and returns the View object.
- **$builder-&gt;getLayout()**

    Returns the currently set Layout.
- **$builder-&gt;getPartial($name)**

    - string *$name* - The given name of the partial

    Returns the partial with the given name.
- **$builder-&gt;build()**

    Builds the entire HTML with the given parameters.

#### Parameter Manager

[](#parameter-manager)

Parameter managers are used to consistently store variables for use in the theme. The Builder has a global one, and every View has a local one.

- **$pm-&gt;reset()**

    Resets the object to its original state.
- **$pm-&gt;getParams()**

    Returns an array of parameters.
- **$pm-&gt;getParam($key, $fallback = undefined)**

    - string *$key* - The key for the value
    - mixed *$fallback*

    Returns the value stored with $key. The fallback is activated through func\_num\_args() so it works even when using `null`.

    **Throws:** *\\OutOfBoundsException* - If the value was not set and a fallback is not available
- **$pm-&gt;setParam($key, $value)**

    - string *$key* - The key for the value
    - mixed *$value* - The value

    Sets a parameter
- **$pm-&gt;setParams($array)**

    - array *$array* - An array of parameters to set

    Takes an array and inserts every single parameter. Doesn't delete previous parameters.

#### View

[](#view)

The View returned by the Builder is usually a custom object extending \\Hongyukeji\\PluginTheme\\View.

There's also a bunch of shortcuts to go to the above levels available (getBuilder, getBuilderParamManager, getTheme, getAssetManager)

**It's compulsory to override the `toString()` method (not the `__toString()` magic method!) in order to output the HTML. This function should output HTML or return a string.**

- **$view-&gt;toString()**

    Called when the HTML must be generated. It should contain the classic HTML building logic. `$this` can be used. No manual output buffering is necessary.
- **$view-&gt;getType()**

    Returns the type of View, either `layout` or `partial`.
- **$view-&gt;getView()**

    Returns the name of the View.
- **$view-&gt;getParamManager()**

    Returns the local parameter manager.
- **$view-&gt;build()**

    Builds *and caches* the HTML. Returns the HTML.
- **$view-&gt;doBuild()**

    Builds the HTML and stores it in a variable. Rebuilds the HTML every time it's called.

    *CHAINABLE*

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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

4

Last Release

2405d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/484917e0c99c9779961352578c18bae13504567d6ec43cc3c594b3e447aad436?d=identicon)[hongyukeji](/maintainers/hongyukeji)

---

Top Contributors

[![oohnoitz](https://avatars.githubusercontent.com/u/916311?v=4)](https://github.com/oohnoitz "oohnoitz (3 commits)")[![woxxy](https://avatars.githubusercontent.com/u/764128?v=4)](https://github.com/woxxy "woxxy (3 commits)")

---

Tags

templatethemeviews

### Embed Badge

![Health badge](/badges/hongyukeji-plugin-theme/health.svg)

```
[![Health](https://phpackages.com/badges/hongyukeji-plugin-theme/health.svg)](https://phpackages.com/packages/hongyukeji-plugin-theme)
```

###  Alternatives

[almasaeed2010/adminlte

AdminLTE - admin control panel and dashboard that's based on Bootstrap 4

45.3k8.5M138](/packages/almasaeed2010-adminlte)[acacha/admin-lte-template-laravel

AdminLTE template applied to Laravel Scaffolding

1.8k387.2k8](/packages/acacha-admin-lte-template-laravel)[duncan3dc/blade

Use Laravel Blade templates without the full Laravel framework

160499.5k24](/packages/duncan3dc-blade)[phug/phug

Pug (ex-Jade) facade engine for PHP, HTML template engine structured by indentation

67292.2k12](/packages/phug-phug)[yiister/yii2-adminlte

yii2-adminlte is a package for yii framework 2 that consists a very popular backend template AdminLTE (based on bootstrap 3).

2839.3k](/packages/yiister-yii2-adminlte)[contao-themes-net/mate-theme-bundle

mate theme bundle for Contao 5

1219.2k1](/packages/contao-themes-net-mate-theme-bundle)

PHPackages © 2026

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