PHPackages                             chemaclass/knob-base - 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. chemaclass/knob-base

AbandonedArchivedLibrary[Framework](/categories/framework)

chemaclass/knob-base
====================

Project base to use Knob MVC PHP Framework.

1.1.5.2(9y ago)0166[3 issues](https://github.com/Chemaclass/knob-base/issues)[1 PRs](https://github.com/Chemaclass/knob-base/pulls)MITPHPPHP &gt;=5.6

Since Oct 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Chemaclass/knob-base)[ Packagist](https://packagist.org/packages/chemaclass/knob-base)[ Docs](http://knob.chemaclass.com)[ RSS](/packages/chemaclass-knob-base/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

README
======

[](#readme)

### What's this repository?

[](#whats-this-repository)

- Knob-base: project base to use Knob MVC PHP Framework
- This is a PHP MVC Framework to create WordPress templates easier and funnier than ever before.
- Author: José María Valera Reales

Knob-base is the kernel from [Knob-mvc](https://github.com/Chemaclass/knob-mvc/)
--------------------------------------------------------------------------------

[](#knob-base-is-the-kernel-from-knob-mvc)

- This is a Framework based on MVC pattern.
- Knob-base should not be focus on any style of the page, but deal with WP and provide models instead.
- Inspired by latest frameworks we have nowadays for web development such Symfony or Laravel.
- Regarding any question about WP kernel: take a look the official WP documentation: [WP Codex](https://codex.wordpress.org/) and [WP Reference](https://developer.wordpress.org/reference/).

Creating basic controllers and views
------------------------------------

[](#creating-basic-controllers-and-views)

- `HomeController`: Controller for all files from WP:
    - author.php `->getAuthor()`: render the `base/author.mustache` template
    - archive.php `->getArchive()`: render the `base/search.mustache` template
    - category.php `->getCategory()`: render the `base/search.mustache` template
    - home.php `->getHome()`: render the `base/home.mustache` template
    - search.php `->getSearch()`: render the `base/search.mustache` template
    - single.php `->getSingle($type = 'post')`: render the `base/[post|page].mustache` template
    - tag.php `->getTag()`: render the `base/search.mustache` template
    - 404.php `->get404()`: render the `base/error_404.mustache` template

### Calling a controller from a WordPress template page.

[](#calling-a-controller-from-a-wordpress-template-page)

[Create a template for WordPress](http://codex.wordpress.org/Template_Hierarchy), for example single.php which is used when a Post is loaded.

```
use Controllers\HomeController;

$controller = new HomeController();
$controller->getSingle('post');
```

### Models to get all values from your DB

[](#models-to-get-all-values-from-your-db)

- You can find all models as Entities from your DB in 'Knob\\Models' (src/models/ directory). For example `Post`:

```
// vendor/chemaclass/knob-base/src/models/Post.php
namespace Knob\Models;

class Post extends ModelBase
{
    public static $table = "posts";

    public function getSlug()
    {
        return $this->post_name;
    }

    public function getAuthor()
    {
        return User::find($this->post_author);
    }

    // more sentences...
}
```

- You will be provided with libraries to prepare your `Actions` and `Filters` (from WordPress). For example `Actions`:

```
// vendor/chemaclass/knob-base/src/libs/Actions.php
namespace Knob\Libs;

class Actions
{
    public static function setup()
    {
        static::adminPrintScripts();
        static::adminPrintStyles();
        static::loginView();
        static::wpBeforeAdminBarRender();
    }

    // rest of the implementation...
}
```

- Also you will be able to create your own widgets as new models. You have the basics in `Knob\Widgets` (src/widgets/ directory). For example PagesWidget:

```
// vendor/chemaclass/knob-base/src/widgets/PagesWidget.php
namespace Knob\Widgets;

use Knob\Models\Post;

class PagesWidget extends WidgetBase
{
    public function widget($args, $instance)
    {
        $instance['pages'] = Post::getPages();
        parent::widget($args, $instance);
    }
}
```

- All of these on the best&amp;easy way ever in `Knob\libs` (src/libs/ directory)

### Views based on [Mustache](http://mustache.github.com/) templates

[](#views-based-on-mustache-templates)

- All you have to care basically are your templates. That's why we choose Mustache. Is simple, flexible and fun.

### Controllers to pull everything together

[](#controllers-to-pull-everything-together)

- From `Knob\Controllers` (src/controllers/ directory)
- You will be provided a `Knob\Controllers\BaseController` to extends your own controllers.

```
// app/controllers/BaseController.php
namespace Controllers;

use Knob\Controllers\BaseController as KnobBaseController;

class BaseController extends KnobBaseController
{
	// more sentences...
}
```

- Then your `HomeController` could seems like:

```
// app/controllers/HomeController.php
namespace Controllers;

use Knob\Controllers\HomeControllerInterface;
use Models\Option;

class HomeController extends BaseController implements HomeControllerInterface {

    /**
     * home.php
     */
    public function getHome()
    {
        $args = [
            'posts' => Post::getAll(Option::get('posts_per_page'))
        ];
        return $this->renderPage('base/home', $args);
    }

	// rest of the implementation...
}
```

Before the start... you'll need!
================================

[](#before-the-start-youll-need)

### Install ruby and compass

[](#install-ruby-and-compass)

- sudo apt-get install ruby
- sudo gem update --system
- sudo apt-get install ruby1.9.1-dev
- sudo gem install compass
- sudo gem install rake

### Then, you will be able to compile the scss in the directory of your project:

[](#then-you-will-be-able-to-compile-the-scss-in-the-directory-of-your-project)

- /knob-mvc $&gt; rake watch\_scss

### You'll need a PHP graphics library to be able to use the image editor:

[](#youll-need-a-php-graphics-library-to-be-able-to-use-the-image-editor)

- apt-get install php-imagick php7.0-gd
- service apache2 reload

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~78 days

Total

7

Last Release

3348d ago

Major Versions

0.4.0 → 1.0.92016-04-02

PHP version history (2 changes)0.4.0PHP &gt;=5.4

1.1.5.2PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d166420c6770c5941e10bd68b2d26501eabb432e280d8e6eba0a344bcc1e5ae?d=identicon)[Chemaclass](/maintainers/Chemaclass)

---

Top Contributors

[![Chemaclass](https://avatars.githubusercontent.com/u/5256287?v=4)](https://github.com/Chemaclass "Chemaclass (186 commits)")

---

Tags

kernelknob-mvcphpphp-mvc-frameworkwordpresswordpressmvcknob

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chemaclass-knob-base/health.svg)

```
[![Health](https://phpackages.com/badges/chemaclass-knob-base/health.svg)](https://phpackages.com/packages/chemaclass-knob-base)
```

###  Alternatives

[justcoded/wordpress-theme-framework

Lightweight theme framework base with Model-View concept for developers who want to better organize their own custom themes.

264.1k2](/packages/justcoded-wordpress-theme-framework)[thecodeco/wpmvc

MVC framework for WordPress

102.0k](/packages/thecodeco-wpmvc)

PHPackages © 2026

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